Class ConfigurationNodePointer<T>
java.lang.Object
org.apache.commons.jxpath.ri.model.NodePointer
org.apache.commons.configuration2.tree.xpath.ConfigurationNodePointer<T>
- Type Parameters:
T- the type of the nodes this pointer deals with
- All Implemented Interfaces:
Serializable,Cloneable,Comparable,org.apache.commons.jxpath.Pointer
final class ConfigurationNodePointer<T>
extends org.apache.commons.jxpath.ri.model.NodePointer
A specific NodePointer implementation for configuration nodes.
This is needed for queries using JXPath.
- Since:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final NodeHandler<T> The node handler.private final TStores the associated node.private static final longThe serial version UID.Fields inherited from class org.apache.commons.jxpath.ri.model.NodePointer
index, locale, parent, UNKNOWN_NAMESPACE, WHOLE_COLLECTION -
Constructor Summary
ConstructorsConstructorDescriptionConfigurationNodePointer(ConfigurationNodePointer<T> parent, T node, NodeHandler<T> handler) Creates a new instance ofConfigurationNodePointerand initializes it with its parent pointer.ConfigurationNodePointer(T node, Locale locale, NodeHandler<T> handler) Creates a new instance ofConfigurationNodePointerpointing to the specified node. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.commons.jxpath.ri.model.NodeIteratorattributeIterator(org.apache.commons.jxpath.ri.QName name) Returns an iterator for the attributes that match the given name.private ConfigurationNodePointer<T> castPointer(org.apache.commons.jxpath.ri.model.NodePointer p) Casts the given child pointer to a node pointer of this type.org.apache.commons.jxpath.ri.model.NodeIteratorchildIterator(org.apache.commons.jxpath.ri.compiler.NodeTest test, boolean reverse, org.apache.commons.jxpath.ri.model.NodePointer startWith) Returns an iterator for the children of this pointer that match the given test object.intcompareChildNodePointers(org.apache.commons.jxpath.ri.model.NodePointer pointer1, org.apache.commons.jxpath.ri.model.NodePointer pointer2) Compares two child node pointers.Gets this node's base value.Gets the wrapped configuration node.Gets the immediate node.intGets this node's length.org.apache.commons.jxpath.ri.QNamegetName()Gets this node's name.Gets theNodeHandlerused by this instance.getValue()Gets the value of this node.booleanChecks whether this node pointer refers to an attribute node.booleanReturns a flag if this node is a collection.booleanisLeaf()Returns a flag whether this node is a leaf.voidSets the value of this node.booleantestNode(org.apache.commons.jxpath.ri.compiler.NodeTest test) Tests if this node matches the given test.Methods inherited from class org.apache.commons.jxpath.ri.model.NodePointer
asPath, clone, compareTo, createAttribute, createChild, createChild, createPath, createPath, escape, getAbstractFactory, getDefaultNamespaceURI, getImmediateParentPointer, getImmediateValuePointer, getIndex, getLocale, getNamespaceResolver, getNamespaceURI, getNamespaceURI, getNode, getNodeSetByKey, getNodeValue, getParent, getPointerByID, getPointerByKey, getRootNode, getValuePointer, isActual, isContainer, isDefaultNamespace, isLanguage, isNode, isRoot, namespaceIterator, namespacePointer, newChildNodePointer, newNodePointer, printPointerChain, remove, setAttribute, setIndex, setNamespaceResolver, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDThe serial version UID.- See Also:
-
handler
The node handler. -
node
Stores the associated node.
-
-
Constructor Details
-
ConfigurationNodePointer
Creates a new instance ofConfigurationNodePointerand initializes it with its parent pointer.- Parameters:
parent- the parent pointernode- the associated nodehandler- theNodeHandler
-
ConfigurationNodePointer
Creates a new instance ofConfigurationNodePointerpointing to the specified node.- Parameters:
node- the wrapped nodelocale- the localehandler- theNodeHandler
-
-
Method Details
-
attributeIterator
public org.apache.commons.jxpath.ri.model.NodeIterator attributeIterator(org.apache.commons.jxpath.ri.QName name) Returns an iterator for the attributes that match the given name.- Overrides:
attributeIteratorin classorg.apache.commons.jxpath.ri.model.NodePointer- Parameters:
name- the attribute name- Returns:
- the iterator for the attributes
-
castPointer
Casts the given child pointer to a node pointer of this type. This is a bit dangerous. However, in a typical setup, child node pointers can only be created by this instance which ensures that they are of the correct type. Therefore, this cast is safe.- Parameters:
p- theNodePointerto cast- Returns:
- the resulting
ConfigurationNodePointer
-
childIterator
public org.apache.commons.jxpath.ri.model.NodeIterator childIterator(org.apache.commons.jxpath.ri.compiler.NodeTest test, boolean reverse, org.apache.commons.jxpath.ri.model.NodePointer startWith) Returns an iterator for the children of this pointer that match the given test object.- Overrides:
childIteratorin classorg.apache.commons.jxpath.ri.model.NodePointer- Parameters:
test- the test objectreverse- the reverse flagstartWith- the start value of the iteration
-
compareChildNodePointers
public int compareChildNodePointers(org.apache.commons.jxpath.ri.model.NodePointer pointer1, org.apache.commons.jxpath.ri.model.NodePointer pointer2) Compares two child node pointers.- Specified by:
compareChildNodePointersin classorg.apache.commons.jxpath.ri.model.NodePointer- Parameters:
pointer1- one pointerpointer2- another pointer- Returns:
- a flag, which pointer should be sorted first
-
getBaseValue
Gets this node's base value. This is the associated configuration node.- Specified by:
getBaseValuein classorg.apache.commons.jxpath.ri.model.NodePointer- Returns:
- the base value
-
getConfigurationNode
Gets the wrapped configuration node.- Returns:
- the wrapped node
-
getImmediateNode
Gets the immediate node. This is the associated configuration node.- Specified by:
getImmediateNodein classorg.apache.commons.jxpath.ri.model.NodePointer- Returns:
- the immediate node
-
getLength
public int getLength()Gets this node's length. This is always 1.- Specified by:
getLengthin classorg.apache.commons.jxpath.ri.model.NodePointer- Returns:
- the node's length
-
getName
public org.apache.commons.jxpath.ri.QName getName()Gets this node's name.- Specified by:
getNamein classorg.apache.commons.jxpath.ri.model.NodePointer- Returns:
- the name
-
getNodeHandler
Gets theNodeHandlerused by this instance.- Returns:
- the
NodeHandler
-
getValue
Gets the value of this node.- Specified by:
getValuein interfaceorg.apache.commons.jxpath.Pointer- Overrides:
getValuein classorg.apache.commons.jxpath.ri.model.NodePointer- Returns:
- the represented node's value
-
isAttribute
public boolean isAttribute()Checks whether this node pointer refers to an attribute node. This is not the case.- Overrides:
isAttributein classorg.apache.commons.jxpath.ri.model.NodePointer- Returns:
- the attribute flag
-
isCollection
public boolean isCollection()Returns a flag if this node is a collection. This is not the case.- Specified by:
isCollectionin classorg.apache.commons.jxpath.ri.model.NodePointer- Returns:
- the collection flag
-
isLeaf
public boolean isLeaf()Returns a flag whether this node is a leaf. This is the case if there are no child nodes.- Specified by:
isLeafin classorg.apache.commons.jxpath.ri.model.NodePointer- Returns:
- a flag if this node is a leaf
-
setValue
Sets the value of this node. This is not supported, so always an exception is thrown.- Specified by:
setValuein interfaceorg.apache.commons.jxpath.Pointer- Specified by:
setValuein classorg.apache.commons.jxpath.ri.model.NodePointer- Parameters:
value- the new value
-
testNode
public boolean testNode(org.apache.commons.jxpath.ri.compiler.NodeTest test) Tests if this node matches the given test. Configuration nodes are text nodes, too because they can contain a value.- Overrides:
testNodein classorg.apache.commons.jxpath.ri.model.NodePointer- Parameters:
test- the test object- Returns:
- a flag if this node corresponds to the test
-