Class PropertyOwnerPointer
- java.lang.Object
-
- org.apache.commons.jxpath.ri.model.NodePointer
-
- org.apache.commons.jxpath.ri.model.beans.PropertyOwnerPointer
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,Pointer
- Direct Known Subclasses:
BeanPointer,DynaBeanPointer,DynamicPointer,NullPointer
public abstract class PropertyOwnerPointer extends NodePointer
A pointer describing a node that has properties, each of which could be a collection.- Version:
- $Revision: 652845 $ $Date: 2008-05-02 12:46:46 -0500 (Fri, 02 May 2008) $
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.ObjectUNINITIALIZEDprivate java.lang.Objectvalue-
Fields inherited from class org.apache.commons.jxpath.ri.model.NodePointer
index, locale, parent, UNKNOWN_NAMESPACE, WHOLE_COLLECTION
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPropertyOwnerPointer(NodePointer parent)Create a new PropertyOwnerPointer.protectedPropertyOwnerPointer(NodePointer parent, java.util.Locale locale)Create a new PropertyOwnerPointer.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description NodeIteratorattributeIterator(QName name)Returns a NodeIterator that iterates over all attributes of the current node matching the supplied node name (could have a wildcard).NodeIteratorchildIterator(NodeTest test, boolean reverse, NodePointer startWith)Returns a NodeIterator that iterates over all children or all children that match the given NodeTest, starting with the specified one.intcompareChildNodePointers(NodePointer pointer1, NodePointer pointer2)Compares two child NodePointers and returns a positive number, zero or a positive number according to the order of the pointers.NodeIteratorcreateNodeIterator(java.lang.String property, boolean reverse, NodePointer startWith)Create a NodeIterator.java.lang.ObjectgetImmediateNode()Returns the object the pointer points to; does not convert it to a "canonical" type.abstract QNamegetName()Returns the name of this node.abstract PropertyPointergetPropertyPointer()Get a PropertyPointer for this PropertyOwnerPointer.booleanisDynamicPropertyDeclarationSupported()Learn whether dynamic property declaration is supported.booleanisValidProperty(QName name)Learn whethernameis a valid child name for this PropertyOwnerPointer.voidremove()If this is a root node pointer, throws an exception; otherwise forwards the call to the parent node.voidsetIndex(int index)Set the index of this NodePointer.voidsetValue(java.lang.Object value)Throws an exception if you try to change the root element, otherwise forwards the call to the parent pointer.-
Methods inherited from class org.apache.commons.jxpath.ri.model.NodePointer
asPath, clone, compareTo, createAttribute, createChild, createChild, createPath, createPath, escape, getAbstractFactory, getBaseValue, getDefaultNamespaceURI, getImmediateParentPointer, getImmediateValuePointer, getIndex, getLength, getLocale, getNamespaceResolver, getNamespaceURI, getNamespaceURI, getNode, getNodeSetByKey, getNodeValue, getParent, getPointerByID, getPointerByKey, getRootNode, getValue, getValuePointer, isActual, isAttribute, isCollection, isContainer, isDefaultNamespace, isLanguage, isLeaf, isNode, isRoot, namespaceIterator, namespacePointer, newChildNodePointer, newNodePointer, printPointerChain, setAttribute, setNamespaceResolver, testNode, toString
-
-
-
-
Constructor Detail
-
PropertyOwnerPointer
protected PropertyOwnerPointer(NodePointer parent, java.util.Locale locale)
Create a new PropertyOwnerPointer.- Parameters:
parent- parent pointerlocale- Locale
-
PropertyOwnerPointer
protected PropertyOwnerPointer(NodePointer parent)
Create a new PropertyOwnerPointer.- Parameters:
parent- pointer
-
-
Method Detail
-
childIterator
public NodeIterator childIterator(NodeTest test, boolean reverse, NodePointer startWith)
Description copied from class:NodePointerReturns a NodeIterator that iterates over all children or all children that match the given NodeTest, starting with the specified one.- Overrides:
childIteratorin classNodePointer- Parameters:
test- NodeTest to filter childrenreverse- specified iteration directionstartWith- the NodePointer to start with- Returns:
- NodeIterator
-
createNodeIterator
public NodeIterator createNodeIterator(java.lang.String property, boolean reverse, NodePointer startWith)
Create a NodeIterator.- Parameters:
property- property namereverse- whether to iterate in reversestartWith- first pointer to return- Returns:
- NodeIterator
-
attributeIterator
public NodeIterator attributeIterator(QName name)
Description copied from class:NodePointerReturns a NodeIterator that iterates over all attributes of the current node matching the supplied node name (could have a wildcard). May return null if the object does not support the attributes.- Overrides:
attributeIteratorin classNodePointer- Parameters:
name- the attribute name to test- Returns:
- NodeIterator
-
setIndex
public void setIndex(int index)
Description copied from class:NodePointerSet the index of this NodePointer.- Overrides:
setIndexin classNodePointer- Parameters:
index- int
-
getImmediateNode
public java.lang.Object getImmediateNode()
Description copied from class:NodePointerReturns the object the pointer points to; does not convert it to a "canonical" type.- Specified by:
getImmediateNodein classNodePointer- Returns:
- Object node
-
getName
public abstract QName getName()
Description copied from class:NodePointerReturns the name of this node. Can be null.- Specified by:
getNamein classNodePointer- Returns:
- QName
-
isValidProperty
public boolean isValidProperty(QName name)
Learn whethernameis a valid child name for this PropertyOwnerPointer.- Parameters:
name- the QName to test- Returns:
trueifQNameis a valid property name.- Since:
- JXPath 1.3
-
setValue
public void setValue(java.lang.Object value)
Throws an exception if you try to change the root element, otherwise forwards the call to the parent pointer.- Specified by:
setValuein interfacePointer- Specified by:
setValuein classNodePointer- Parameters:
value- to set
-
remove
public void remove()
If this is a root node pointer, throws an exception; otherwise forwards the call to the parent node.- Overrides:
removein classNodePointer
-
getPropertyPointer
public abstract PropertyPointer getPropertyPointer()
Get a PropertyPointer for this PropertyOwnerPointer.- Returns:
- PropertyPointer
-
isDynamicPropertyDeclarationSupported
public boolean isDynamicPropertyDeclarationSupported()
Learn whether dynamic property declaration is supported.- Returns:
- true if the property owner can set a property "does not exist". A good example is a Map. You can always assign a value to any key even if it has never been "declared".
-
compareChildNodePointers
public int compareChildNodePointers(NodePointer pointer1, NodePointer pointer2)
Description copied from class:NodePointerCompares two child NodePointers and returns a positive number, zero or a positive number according to the order of the pointers.- Specified by:
compareChildNodePointersin classNodePointer- Parameters:
pointer1- first pointer to be comparedpointer2- second pointer to be compared- Returns:
- int per Java comparison conventions
-
-