Class NavuLeafList
NavuLeafList
is a representation of the YANG leaf-list.
When accessing individual elements trough containsNode
,
NavuLeafList
will only make one single exists
call (over MAAPI or CDB depending on the context) to check the
existence of the key, thus making the operation cheap.
The set of leaf-list entries can be retrieved through elements()
or by retrieving an iterator iterator()
. The difference between the
two is that elements()
will make a single call to retrieve all
the leaf-list elements, while iterator()
will try to fetch
leaf-list elements one by one using getNext() calls whenever possible.
NavuNode parent = ...; NavuLeafList someLeafList = parent.leafList(someNamespace._someLeafList); for (ConfValue value : someLeafList) { // Here the elements will be fetched one by one } for (ConfValue value : someLeafList.elements()) { // Here the elements will be fetched using a single call // and stored in memory for the duration of the iteration }
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsNode
(ConfValue elem) Returns true if and only if thisNavuLeafList
contains this element.boolean
containsNode
(String elemStr) Returns true if and only if thisNavuLeafList
contains this element.void
Creates leaf-list entry.void
Creates leaf-list entry.void
Deletes an entry from the leaf-list.void
Deletes an entry from the leaf-list.elements()
Returns a copy of elements contained by the leaf-list node.boolean
isEmpty()
Checks if there are any elements in the leaf-list.iterator()
Retrieve a iterator over the elements in thisNavuLeafList
(in proper sequence).void
move
(ConfValue elem, NavuLeafList.WhereTo whereTo, ConfValue to) Move a leaf-list element to a new position.void
move
(String elemStr, NavuLeafList.WhereTo whereTo, String toStr) Move a leaf-list element to a new position.void
safeCreate
(ConfValue elem) The variant ofcreate
that succeeds even if the object already exists.void
safeCreate
(String elemStr) The variant ofcreate
that succeeds even if the object already exists.void
sharedCreate
(ConfValue elem) The variant ofcreate
that succeeds even if the object already exists, and also maintains a reference counter on the object.void
sharedCreate
(String elemStr) The variant ofcreate
that succeeds even if the object already exists, and also maintains a reference counter on the object.int
size()
Returns the number of leaf-list elements contained by the leaf-list.Methods inherited from class com.tailf.navu.NavuLeaf
create, delete, deref, encodeValues, encodeXML, equals, exists, getCdbSession, getChangeFlag, getOldValue, getParent, getRootNS, getValues, idrefDerivedOrSelf, isKey, reset, safeCreate, select, select, select, set, set, setChange, setValues, sharedCreate, sharedSet, sharedSet, toKey, toString, value, valueAsString, valueUpdateInd
Methods inherited from class com.tailf.navu.NavuNode
children, container, container, container, container, context, getChange, getChanges, getChanges, getChanges, getChanges, getChanges, getChanges, getConfPath, getInfo, getKeyPath, getName, getNavuNode, getValues, getXml, hashCode, leaf, leaf, leaf, leaf, leafList, leafList, leafList, leafList, list, list, list, list, namespace, prepareXMLCall, setValues, sharedSetValues, sharedSetValues, startCdbSession, stopCdbSession, xPathSelect, xPathSelectIterate
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
containsNode
Returns true if and only if thisNavuLeafList
contains this element.- Parameters:
elem
- whose presence in thisNavuLeafList
is to be tested- Returns:
true
if thisNavuLeafList
contains the element- Throws:
NavuException
-
containsNode
Returns true if and only if thisNavuLeafList
contains this element.- Parameters:
elemStr
- string representation of the element whose presence in thisNavuLeafList
is to be tested- Returns:
true
if thisNavuLeafList
contains the element- Throws:
NavuException
-
create
Creates leaf-list entry.We have 3 different variants of
create
.create()
This method creates the leaf-list entry. If such entry already exists tt will fail with aNavuException
with the error code set toErrorCode.ERR_ALREADY_EXISTS
.safeCreate()
similar tocreate()
with the sole difference that is silently succeeds even if the leaf-list entry already exists.sharedCreate()
This method is useful when creating element in FASTMAP code, i.e code that implements a FASTMAP service. ThesharedCreate()
method maintains a reference counter on the created object. Furthermore, and attribute "backpointer" will be created on the created leaf-list entry indicating which "service" created the object
- Parameters:
elem
- the leaf-list entry to be created- Throws:
NavuException
- if any MAAPI operations fail during the create or IOException if socket errors would occur, or such entry already exists
-
create
Creates leaf-list entry.We have 3 different variants of
create
.create()
This method creates the leaf-list entry. If such entry already exists tt will fail with aNavuException
with the error code set toErrorCode.ERR_ALREADY_EXISTS
.safeCreate()
similar tocreate()
with the sole difference that is silently succeeds even if the leaf-list entry already exists.sharedCreate()
This method is useful when creating element in FASTMAP code, i.e code that implements a FASTMAP service. ThesharedCreate()
method maintains a reference counter on the created object. Furthermore, and attribute "backpointer" will be created on the created leaf-list entry indicating which "service" created the object
- Parameters:
elemStr
- the string representation of the leaf-list entry to be created- Throws:
NavuException
- if any MAAPI operations fail during the create or IOException if socket errors would occur, or such entry already exists.
-
safeCreate
The variant ofcreate
that succeeds even if the object already exists.- Parameters:
elem
- the leaf-list entry to be created- Throws:
NavuException
- if any MAAPI operations fail during the create or IOException if socket errors would occur.
-
safeCreate
The variant ofcreate
that succeeds even if the object already exists.- Parameters:
elemStr
- the string representation of the leaf-list entry to be created- Throws:
NavuException
- if any MAAPI operations fail during the create or IOException if socket errors would occur.
-
delete
Deletes an entry from the leaf-list.- Parameters:
elem
- the element to delete.- Throws:
NavuException
- If the method fails to delete the element.
-
delete
Deletes an entry from the leaf-list.- Parameters:
elemStr
- string representation of the element to delete.- Throws:
NavuException
- If the method fails to delete the element.
-
elements
Returns a copy of elements contained by the leaf-list node.- Returns:
- a copy of the collection of list elements.
- Throws:
NavuException
- if the elements could not be retrieved.
-
isEmpty
Checks if there are any elements in the leaf-list.- Returns:
- true if there no list entries, false otherwise,
- Throws:
NavuException
-
size
Returns the number of leaf-list elements contained by the leaf-list.- Returns:
- the number of elements.
- Throws:
NavuException
-
iterator
Retrieve a iterator over the elements in thisNavuLeafList
(in proper sequence).
-