Home » commons-jxpath-1.3-src » org.apache.commons.jxpath.ri.model » [javadoc | source]
org.apache.commons.jxpath.ri.model
abstract public class: NodePointer [javadoc | source]
java.lang.Object
   org.apache.commons.jxpath.ri.model.NodePointer

All Implemented Interfaces:
    Pointer

Common superclass for Pointers of all kinds. A NodePointer maps to a deterministic XPath that represents the location of a node in an object graph. This XPath uses only simple axes: child, namespace and attribute and only simple, context-independent predicates.
Field Summary
public static final  int WHOLE_COLLECTION     
protected  int index     
public static final  String UNKNOWN_NAMESPACE     
protected  NodePointer parent     
protected  Locale locale     
Constructor:
 protected NodePointer(NodePointer parent) 
 protected NodePointer(NodePointer parent,
    Locale locale) 
Method from org.apache.commons.jxpath.ri.model.NodePointer Summary:
asPath,   attributeIterator,   childIterator,   clone,   compareChildNodePointers,   compareTo,   createAttribute,   createChild,   createChild,   createPath,   createPath,   getBaseValue,   getDefaultNamespaceURI,   getImmediateNode,   getImmediateParentPointer,   getImmediateValuePointer,   getIndex,   getLength,   getLocale,   getName,   getNamespaceResolver,   getNamespaceURI,   getNamespaceURI,   getNode,   getNodeValue,   getParent,   getPointerByID,   getPointerByKey,   getRootNode,   getValue,   getValuePointer,   isActual,   isAttribute,   isCollection,   isContainer,   isDefaultNamespace,   isLanguage,   isLeaf,   isNode,   isRoot,   namespaceIterator,   namespacePointer,   newChildNodePointer,   newNodePointer,   printPointerChain,   remove,   setAttribute,   setIndex,   setNamespaceResolver,   setValue,   testNode,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.commons.jxpath.ri.model.NodePointer Detail:
 public String asPath() 
    Returns an XPath that maps to this Pointer.
 public NodeIterator attributeIterator(QName qname) 
    Returns 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.
 public NodeIterator childIterator(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.
 public Object clone() 
 abstract public int compareChildNodePointers(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.
 public int compareTo(Object object) 
 public NodePointer createAttribute(JXPathContext context,
    QName name) 
    Called to create a non-existing attribute
 public NodePointer createChild(JXPathContext context,
    QName name,
    int index) 
    Called by a child pointer when it needs to create a parent object for a non-existent collection element. It may have to expand the collection, then create an element object and return a new pointer describing the newly created element.
 public NodePointer createChild(JXPathContext context,
    QName name,
    int index,
    Object value) 
    Called by a child pointer if that child needs to assign the value supplied in the createPath(context, value) call to a non-existent node. This method may have to expand the collection in order to assign the element.
 public NodePointer createPath(JXPathContext context) 
    Called by a child pointer when it needs to create a parent object. Must create an object described by this pointer and return a new pointer that properly describes the new object.
 public NodePointer createPath(JXPathContext context,
    Object value) 
    Called directly by JXPathContext. Must create path and set value.
 abstract public Object getBaseValue()
    Returns the value represented by the pointer before indexing. So, if the node represents an element of a collection, this method returns the collection itself.
 protected String getDefaultNamespaceURI() 
 abstract public Object getImmediateNode()
    Returns the object the pointer points to; does not convert it to a "canonical" type.
 public NodePointer getImmediateParentPointer() 
 public NodePointer getImmediateValuePointer() 
 public int getIndex() 
    If the pointer represents a collection, the index identifies an element of that collection. The default value of index is WHOLE_COLLECTION, which just means that the pointer is not indexed at all. Note: the index on NodePointer starts with 0, not 1.
 abstract public int getLength()
    If the pointer represents a collection (or collection element), returns the length of the collection. Otherwise returns 1 (even if the value is null).
 public Locale getLocale() 
    If the Pointer has a parent, returns the parent's locale; otherwise returns the locale specified when this Pointer was created.
 abstract public QName getName()
    Returns the name of this node. Can be null.
 public NamespaceResolver getNamespaceResolver() 
 public String getNamespaceURI() 
    Returns the namespace URI associated with this Pointer.
 public String getNamespaceURI(String prefix) 
    Decodes a namespace prefix to the corresponding URI.
 public Object getNode() 
    Returns the object the pointer points to; does not convert it to a "canonical" type. Opens containers, properties etc and returns the ultimate contents.
 public Object getNodeValue() 
Deprecated! 1.1 - Please use getNode()

    Returns the object the pointer points to; does not convert it to a "canonical" type.
 public NodePointer getParent() 
 public Pointer getPointerByID(JXPathContext context,
    String id) 
    Locates a node by ID.
 public Pointer getPointerByKey(JXPathContext context,
    String key,
    String value) 
    Locates a node by key and value.
 public Object getRootNode() 
 public Object getValue() 
    By default, returns getNode(), can be overridden to return a "canonical" value, like for instance a DOM element should return its string value.
 public NodePointer getValuePointer() 
    If this pointer manages a transparent container, like a variable, this method returns the pointer to the contents. Only an auxiliary (non-node) pointer can (and should) return a value pointer other than itself. Note that you probably don't want to override getValuePointer() directly. Override the getImmediateValuePointer() method instead. The getValuePointer() method is calls getImmediateValuePointer() and, if the result is not this, invokes getValuePointer() recursively. The idea here is to open all nested containers. Let's say we have a container within a container within a container. The getValuePointer() method should then open all those containers and return the pointer to the ultimate contents. It does so with the above recursion.
 public boolean isActual() 
    An actual pointer points to an existing part of an object graph, even if it is null. A non-actual pointer represents a part that does not exist at all. For instance consider the pointer "/address/street". If both address and street are not null, the pointer is actual. If address is not null, but street is null, the pointer is still actual. If address is null, the pointer is not actual. (In JavaBeans) if address is not a property of the root bean, a Pointer for this path cannot be obtained at all - actual or otherwise.
 public boolean isAttribute() 
    Returns true if the pointer represents the "attribute::" axis.
 abstract public boolean isCollection()
    Returns true if the value of the pointer is an array or a Collection.
 public boolean isContainer() 
    If true, this node is axiliary and can only be used as an intermediate in the chain of pointers.
 protected boolean isDefaultNamespace(String prefix) 
    Returns true if the supplied prefix represents the default namespace in the context of the current node.
 public boolean isLanguage(String lang) 
    Returns true if the selected locale name starts with the specified prefix lang, case-insensitive.
 abstract public boolean isLeaf()
    If true, this node does not have children
 public boolean isNode() 
Deprecated! Please - use !isContainer()

 public boolean isRoot() 
    Returns true if this Pointer has no parent.
 public NodeIterator namespaceIterator() 
    Returns a NodeIterator that iterates over all namespaces of the value currently pointed at. May return null if the object does not support the namespaces.
 public NodePointer namespacePointer(String namespace) 
    Returns a NodePointer for the specified namespace. Will return null if namespaces are not supported. Will return UNKNOWN_NAMESPACE if there is no such namespace.
 public static NodePointer newChildNodePointer(NodePointer parent,
    QName name,
    Object bean) 
    Allocates an new child NodePointer by iterating through all installed NodePointerFactories until it finds one that can create a pointer.
 public static NodePointer newNodePointer(QName name,
    Object bean,
    Locale locale) 
    Allocates an entirely new NodePointer by iterating through all installed NodePointerFactories until it finds one that can create a pointer.
 public  void printPointerChain() 
    Print internal structure of a pointer for debugging
 public  void remove() 
    Remove the node of the object graph this pointer points to.
 public  void setAttribute(boolean attribute) 
    Set to true if the pointer represents the "attribute::" axis.
 public  void setIndex(int index) 
 public  void setNamespaceResolver(NamespaceResolver namespaceResolver) 
 abstract public  void setValue(Object value)
    Converts the value to the required type and changes the corresponding object to that value.
 public boolean testNode(NodeTest test) 
    Checks if this Pointer matches the supplied NodeTest.
 public String toString()