Class ConfigurationAttributePointer<T>
java.lang.Object
org.apache.commons.jxpath.ri.model.NodePointer
org.apache.commons.configuration2.tree.xpath.ConfigurationAttributePointer<T>
- Type Parameters:
T
- the type of the nodes this pointer deals with
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable
,org.apache.commons.jxpath.Pointer
class ConfigurationAttributePointer<T>
extends org.apache.commons.jxpath.ri.model.NodePointer
A specialized NodePointer
implementation for the attributes of a configuration node.
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final QueryResult<T>
Stores information about the represented attribute.private static final long
The serial version UID.Fields inherited from class org.apache.commons.jxpath.ri.model.NodePointer
index, locale, parent, UNKNOWN_NAMESPACE, WHOLE_COLLECTION
-
Constructor Summary
ConstructorsConstructorDescriptionConfigurationAttributePointer
(ConfigurationNodePointer<T> parent, String attrName) Creates a new instance ofConfigurationAttributePointer
. -
Method Summary
Modifier and TypeMethodDescriptionint
compareChildNodePointers
(org.apache.commons.jxpath.ri.model.NodePointer p1, org.apache.commons.jxpath.ri.model.NodePointer p2) Compares two child node pointers.Gets the base value.Gets the immediate node.int
Gets the length of the represented node.org.apache.commons.jxpath.ri.QName
getName()
Gets the name of this node.private NodeHandler<T>
Returns a reference to the current node handler.Gets a reference to the parent node pointer.getValue()
Returns the value of this node.boolean
Returns a flag whether this node is an attribute.boolean
Returns a flag whether the represented node is a collection.boolean
isLeaf()
Returns a flag whether the represented node is a leaf.void
Sets the value of this node.boolean
testNode
(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, attributeIterator, childIterator, 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:
-
attributeResult
Stores information about the represented attribute.
-
-
Constructor Details
-
ConfigurationAttributePointer
Creates a new instance ofConfigurationAttributePointer
.- Parameters:
parent
- the parent node pointerattrName
- the name of the managed attribute
-
-
Method Details
-
getParentPointer
Gets a reference to the parent node pointer.- Returns:
- the parent pointer
-
compareChildNodePointers
public int compareChildNodePointers(org.apache.commons.jxpath.ri.model.NodePointer p1, org.apache.commons.jxpath.ri.model.NodePointer p2) Compares two child node pointers. Attributes do not have any children, so this is just a dummy implementation.- Specified by:
compareChildNodePointers
in classorg.apache.commons.jxpath.ri.model.NodePointer
- Parameters:
p1
- the first pointerp2
- the second pointer- Returns:
- the order of these pointers
-
getBaseValue
Gets the base value. We return the value.- Specified by:
getBaseValue
in classorg.apache.commons.jxpath.ri.model.NodePointer
- Returns:
- the base value
-
getImmediateNode
Gets the immediate node. This is actually aQueryResult
object describing the represented attribute.- Specified by:
getImmediateNode
in classorg.apache.commons.jxpath.ri.model.NodePointer
- Returns:
- the immediate node
-
getLength
public int getLength()Gets the length of the represented node. This is always 1.- Specified by:
getLength
in classorg.apache.commons.jxpath.ri.model.NodePointer
- Returns:
- the length
-
getName
public org.apache.commons.jxpath.ri.QName getName()Gets the name of this node. This is the attribute name.- Specified by:
getName
in classorg.apache.commons.jxpath.ri.model.NodePointer
- Returns:
- the name of this node
-
isCollection
public boolean isCollection()Returns a flag whether the represented node is a collection. This is not the case.- Specified by:
isCollection
in classorg.apache.commons.jxpath.ri.model.NodePointer
- Returns:
- the collection flag
-
isLeaf
public boolean isLeaf()Returns a flag whether the represented node is a leaf. This is the case for attributes.- Specified by:
isLeaf
in classorg.apache.commons.jxpath.ri.model.NodePointer
- Returns:
- the leaf flag
-
isAttribute
public boolean isAttribute()Returns a flag whether this node is an attribute. Of course, this is the case.- Overrides:
isAttribute
in classorg.apache.commons.jxpath.ri.model.NodePointer
- Returns:
- the attribute flag
-
getValue
Returns the value of this node.- Specified by:
getValue
in interfaceorg.apache.commons.jxpath.Pointer
- Overrides:
getValue
in classorg.apache.commons.jxpath.ri.model.NodePointer
- Returns:
- this node's value
-
setValue
Sets the value of this node. This is not supported because the classes of theXPathExpressionEngine
are only used for queries. This implementation always throws an exception.- Specified by:
setValue
in interfaceorg.apache.commons.jxpath.Pointer
- Specified by:
setValue
in 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. Attribute nodes are text nodes, too, because they can contain a value.- Overrides:
testNode
in classorg.apache.commons.jxpath.ri.model.NodePointer
- Parameters:
test
- the test object- Returns:
- a flag if this node corresponds to the test
-
getNodeHandler
Returns a reference to the current node handler. The handler is obtained from the parent pointer.- Returns:
- the node handler
-