## org.apache.commons.configuration.tree.xpath
Class ConfigurationNodePointer

    java.lang.Object
      org.apache.commons.jxpath.ri.model.NodePointer
          org.apache.commons.configuration.tree.xpath.ConfigurationNodePointer

All Implemented Interfaces:
  Serializable, Cloneable, Comparable, org.apache.commons.jxpath.Pointer

     class ConfigurationNodePointer

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
Version:
  $Id: ConfigurationNodePointer.java 439648 2006-09-02 20:42:10Z oheger $
Author:
  Oliver Heger

Field Summary

Fields inherited from class org.apache.commons.jxpath.ri.model.NodePointer
`index, locale, parent, UNKNOWN_NAMESPACE, WHOLE_COLLECTION`

Constructor Summary
`ConfigurationNodePointer(ConfigurationNode node, Locale locale)` Creates a new instance of `ConfigurationNodePointer`.
`ConfigurationNodePointer(org.apache.commons.jxpath.ri.model.NodePointer parent, ConfigurationNode node)` Creates a new instance of `ConfigurationNodePointer` and initializes it with its parent pointer.

Method Summary
`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.
`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.
`int` `compareChildNodePointers(org.apache.commons.jxpath.ri.model.NodePointer pointer1, org.apache.commons.jxpath.ri.model.NodePointer pointer2)` Compares two child node pointers.
`Object` `getBaseValue()` Returns this node's base value.
`Object` `getImmediateNode()` Returns the immediate node.
`int` `getLength()` Returns this node's length.
`org.apache.commons.jxpath.ri.QName` `getName()` Returns this node's name.
`Object` `getValue()` Returns the value of this node.
`boolean` `isAttribute()` Checks whether this node pointer refers to an attribute node.
`boolean` `isCollection()` Returns a flag if this node is a collection.
`boolean` `isLeaf()` Returns a flag whether this node is a leaf.
`void` `setValue(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, clone, compareTo, createAttribute, createChild, createChild, createPath, createPath, getDefaultNamespaceURI, getImmediateParentPointer, getImmediateValuePointer, getIndex, getLocale, getNamespaceResolver, getNamespaceURI, getNamespaceURI, getNode, getNodeValue, getParent, getPointerByID, getPointerByKey, getRootNode, getValuePointer, isActual, isContainer, isDefaultNamespace, isLanguage, isNode, isRoot, namespaceIterator, namespacePointer, newChildNodePointer, newNodePointer, printPointerChain, remove, setAttribute, setIndex, setNamespaceResolver, toString`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ConfigurationNodePointer

    public ConfigurationNodePointer(ConfigurationNode node,
                                    Locale locale)

  Creates a new instance of `ConfigurationNodePointer`.

  Parameters:
    `node` - the node
    `locale` - the locale

### ConfigurationNodePointer

    public ConfigurationNodePointer(org.apache.commons.jxpath.ri.model.NodePointer parent,
                                    ConfigurationNode node)

  Creates a new instance of `ConfigurationNodePointer` and initializes it with its parent pointer.

  Parameters:
    `parent` - the parent pointer
    `node` - the associated node

Method Detail

### 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:
    `isLeaf` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Returns:
    a flag if this node is a leaf

### isCollection

    public boolean isCollection()

  Returns a flag if this node is a collection. This is not the case.

  Specified by:
    `isCollection` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Returns:
    the collection flag

### getLength

    public int getLength()

  Returns this node's length. This is always 1.

  Specified by:
    `getLength` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Returns:
    the node's length

### isAttribute

    public boolean isAttribute()

  Checks whether this node pointer refers to an attribute node. This method checks the attribute flag of the associated configuration node.

  Overrides:
    `isAttribute` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Returns:
    the attribute flag

### getName

    public org.apache.commons.jxpath.ri.QName getName()

  Returns this node's name.

  Specified by:
    `getName` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Returns:
    the name

### getBaseValue

    public Object getBaseValue()

  Returns this node's base value. This is the associated configuration node.

  Specified by:
    `getBaseValue` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Returns:
    the base value

### getImmediateNode

    public Object getImmediateNode()

  Returns the immediate node. This is the associated configuration node.

  Specified by:
    `getImmediateNode` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Returns:
    the immediate node

### getValue

    public Object getValue()

  Returns the value of this node.

  Specified by:
    `getValue` in interface `org.apache.commons.jxpath.Pointer`
  Overrides:
    `getValue` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Returns:
    the represented node's value

### setValue

    public void setValue(Object value)

  Sets the value of this node.

  Specified by:
    `setValue` in interface `org.apache.commons.jxpath.Pointer`
  Specified by:
    `setValue` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Parameters:
    `value` - the new value

### 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:
    `compareChildNodePointers` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Parameters:
    `pointer1` - one pointer
    `pointer2` - another pointer
  Returns:
    a flag, which pointer should be sorted first

### 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:
    `attributeIterator` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Parameters:
    `name` - the attribute name
  Returns:
    the iterator for the attributes

### 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:
    `childIterator` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Parameters:
    `test` - the test object
    `reverse` - the reverse flag
    `startWith` - the start value of the iteration

### 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:
    `testNode` in class `org.apache.commons.jxpath.ri.model.NodePointer`
  Parameters:
    `test` - the test object
  Returns:
    a flag if this node corresponds to the test

Copyright © 2001-2006 The Apache Software Foundation. All Rights Reserved.