org.apache.commons.jxpath.ri.model.beans
Class DynamicPropertyPointer

java.lang.Object
  |
  +--org.apache.commons.jxpath.ri.model.NodePointer
        |
        +--org.apache.commons.jxpath.ri.model.beans.PropertyPointer
              |
              +--org.apache.commons.jxpath.ri.model.beans.DynamicPropertyPointer
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, Pointer

public class DynamicPropertyPointer
extends PropertyPointer

Pointer pointing to a property of an object with dynamic properties.

Version:
$Revision: 1.7 $ $Date: 2002/05/30 01:57:23 $
Author:
Dmitri Plotnikov

Field Summary
 
Fields inherited from class org.apache.commons.jxpath.ri.model.beans.PropertyPointer
bean, propertyIndex, UNSPECIFIED_PROPERTY
 
Fields inherited from class org.apache.commons.jxpath.ri.model.NodePointer
index, locale, parent, UNKNOWN_NAMESPACE, WHOLE_COLLECTION
 
Constructor Summary
DynamicPropertyPointer(NodePointer parent, DynamicPropertyHandler handler)
           
 
Method Summary
 java.lang.String asPath()
          Returns an XPath that maps to this Pointer.
 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.
 NodePointer createChild(JXPathContext context, QName name, int index, java.lang.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.
 NodePointer createPath(JXPathContext context)
          Called by a child pointer when it needs to create a parent object.
 NodePointer createPath(JXPathContext context, java.lang.Object value)
          Called directly by JXPathContext.
 java.lang.Object getBaseValue()
          Returns the value of the property, not an element of the collection represented by the property, if any.
 int getLength()
          If the property contains a collection, then the length of that collection, otherwise - 1.
 java.lang.Object getNodeValue()
          If index == WHOLE_COLLECTION, the value of the property, otherwise the value of the index'th element of the collection represented by the property.
 int getPropertyCount()
          Number of the DP object's properties.
 int getPropertyIndex()
          Index of the currently selected property in the list of all properties sorted alphabetically.
 java.lang.String getPropertyName()
          Returns the name of the currently selected property or "*" if none has been selected.
 java.lang.String[] getPropertyNames()
          Names of all properties, sorted alphabetically
protected  boolean isActualProperty()
          A dynamic property is always considered actual - all keys are apparently existing with possibly the value of null.
 boolean isNode()
          This type of node is auxiliary.
 void remove()
          Remove the node of the object graph this pointer points to.
 void setPropertyIndex(int index)
          Index a property by its index in the list of all properties sorted alphabetically.
 void setPropertyName(java.lang.String propertyName)
          Select a property by name.
 void setValue(java.lang.Object value)
          If index == WHOLE_COLLECTION, change the value of the property, otherwise change the value of the index'th element of the collection represented by the property.
 
Methods inherited from class org.apache.commons.jxpath.ri.model.beans.PropertyPointer
compareChildNodePointers, equals, getBean, getName, getValuePointer, hashCode, isActual, isCollection
 
Methods inherited from class org.apache.commons.jxpath.ri.model.NodePointer
attributeIterator, childIterator, clone, compareTo, getDefaultNamespaceURI, getExpandedName, getIndex, getLocale, getNamespaceURI, getNamespaceURI, getParent, getPointerByID, getPointerByKey, getValue, isDefaultNamespace, isLanguage, isLeaf, isRoot, namespaceIterator, namespacePointer, newChildNodePointer, newNodePointer, printPointerChain, setIndex, testNode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DynamicPropertyPointer

public DynamicPropertyPointer(NodePointer parent,
                              DynamicPropertyHandler handler)
Method Detail

isNode

public boolean isNode()
This type of node is auxiliary.

Overrides:
isNode in class NodePointer

getPropertyCount

public int getPropertyCount()
Number of the DP object's properties.

Specified by:
getPropertyCount in class PropertyPointer

getPropertyNames

public java.lang.String[] getPropertyNames()
Names of all properties, sorted alphabetically

Specified by:
getPropertyNames in class PropertyPointer

getPropertyName

public java.lang.String getPropertyName()
Returns the name of the currently selected property or "*" if none has been selected.

Specified by:
getPropertyName in class PropertyPointer

setPropertyName

public void setPropertyName(java.lang.String propertyName)
Select a property by name. If the supplied name is not one of the object's existing properties, it implicitly adds this name to the object's property name list. It does not set the property value though. In order to set the property value, call setValue().

Specified by:
setPropertyName in class PropertyPointer

getPropertyIndex

public int getPropertyIndex()
Index of the currently selected property in the list of all properties sorted alphabetically.

Overrides:
getPropertyIndex in class PropertyPointer

setPropertyIndex

public void setPropertyIndex(int index)
Index a property by its index in the list of all properties sorted alphabetically.

Overrides:
setPropertyIndex in class PropertyPointer

getLength

public int getLength()
If the property contains a collection, then the length of that collection, otherwise - 1.

Overrides:
getLength in class NodePointer

getBaseValue

public java.lang.Object getBaseValue()
Returns the value of the property, not an element of the collection represented by the property, if any.

Specified by:
getBaseValue in class NodePointer

getNodeValue

public java.lang.Object getNodeValue()
If index == WHOLE_COLLECTION, the value of the property, otherwise the value of the index'th element of the collection represented by the property. If the property is not a collection, index should be zero and the value will be the property itself.

Overrides:
getNodeValue in class PropertyPointer

isActualProperty

protected boolean isActualProperty()
A dynamic property is always considered actual - all keys are apparently existing with possibly the value of null.

Specified by:
isActualProperty in class PropertyPointer

setValue

public void setValue(java.lang.Object value)
If index == WHOLE_COLLECTION, change the value of the property, otherwise change the value of the index'th element of the collection represented by the property.

Specified by:
setValue in interface Pointer
Specified by:
setValue in class NodePointer

createPath

public NodePointer createPath(JXPathContext context,
                              java.lang.Object value)
Description copied from class: NodePointer
Called directly by JXPathContext. Must create path and set value.

Overrides:
createPath in class NodePointer

createChild

public NodePointer createChild(JXPathContext context,
                               QName name,
                               int index,
                               java.lang.Object value)
Description copied from class: NodePointer
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 must may have to expand the collection in order to assign the element.

Overrides:
createChild in class NodePointer

createChild

public NodePointer createChild(JXPathContext context,
                               QName name,
                               int index)
Description copied from class: NodePointer
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.

Overrides:
createChild in class NodePointer

createPath

public NodePointer createPath(JXPathContext context)
Description copied from class: NodePointer
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.

Overrides:
createPath in class NodePointer

remove

public void remove()
Description copied from class: NodePointer
Remove the node of the object graph this pointer points to.

Overrides:
remove in class NodePointer

asPath

public java.lang.String asPath()
Description copied from class: NodePointer
Returns an XPath that maps to this Pointer.

Specified by:
asPath in interface Pointer
Overrides:
asPath in class NodePointer


Copyright (c) 2001 - Apache Software Foundation