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:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,org.apache.commons.jxpath.Pointer
final 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
Fields Modifier and Type Field Description private QueryResult<T>
attributeResult
Stores information about the represented attribute.private static long
serialVersionUID
The serial version UID.
-
Constructor Summary
Constructors Constructor Description ConfigurationAttributePointer(ConfigurationNodePointer<T> parent, java.lang.String attrName)
Creates a new instance ofConfigurationAttributePointer
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareChildNodePointers(org.apache.commons.jxpath.ri.model.NodePointer p1, org.apache.commons.jxpath.ri.model.NodePointer p2)
Compares two child node pointers.java.lang.Object
getBaseValue()
Gets the base value.java.lang.Object
getImmediateNode()
Gets the immediate node.int
getLength()
Gets the length of the represented node.org.apache.commons.jxpath.ri.QName
getName()
Gets the name of this node.private NodeHandler<T>
getNodeHandler()
Returns a reference to the current node handler.ConfigurationNodePointer<T>
getParentPointer()
Gets a reference to the parent node pointer.java.lang.Object
getValue()
Returns the value of this node.boolean
isAttribute()
Returns a flag whether this node is an attribute.boolean
isCollection()
Returns a flag whether the represented node is a collection.boolean
isLeaf()
Returns a flag whether the represented node is a leaf.void
setValue(java.lang.Object value)
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 Detail
-
serialVersionUID
private static final long serialVersionUID
The serial version UID.- See Also:
- Constant Field Values
-
attributeResult
private final QueryResult<T> attributeResult
Stores information about the represented attribute.
-
-
Constructor Detail
-
ConfigurationAttributePointer
public ConfigurationAttributePointer(ConfigurationNodePointer<T> parent, java.lang.String attrName)
Creates a new instance ofConfigurationAttributePointer
.- Parameters:
parent
- the parent node pointerattrName
- the name of the managed attribute
-
-
Method Detail
-
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
public java.lang.Object 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
public java.lang.Object 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
-
getNodeHandler
private NodeHandler<T> getNodeHandler()
Returns a reference to the current node handler. The handler is obtained from the parent pointer.- Returns:
- the node handler
-
getParentPointer
public ConfigurationNodePointer<T> getParentPointer()
Gets a reference to the parent node pointer.- Returns:
- the parent pointer
-
getValue
public java.lang.Object 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
-
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
-
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
-
setValue
public void setValue(java.lang.Object value)
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
-
-