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.dynamic.DynamicPropertyPointer
-
- All Implemented Interfaces:
java.io.Serializable,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: 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 DynamicPropertyHandlerhandlerprivate java.lang.Stringnameprivate java.lang.String[]namesprivate java.lang.StringrequiredPropertyNameprivate static longserialVersionUID-
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
Constructors Constructor Description DynamicPropertyPointer(NodePointer parent, DynamicPropertyHandler handler)Create a new DynamicPropertyPointer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringasPath()Returns an XPath that maps to this Pointer.NodePointercreatePath(JXPathContext context)Called by a child pointer when it needs to create a parent object.NodePointercreatePath(JXPathContext context, java.lang.Object value)Called directly by JXPathContext.java.lang.ObjectgetBaseValue()Returns the value of the property, not an element of the collection represented by the property, if any.java.lang.ObjectgetImmediateNode()If index == WHOLE_COLLECTION, the value of the property, otherwise the value of the index'th element of the collection represented by the property.intgetPropertyCount()Number of the DP object's properties.intgetPropertyIndex()Index of the currently selected property in the list of all properties sorted alphabetically.java.lang.StringgetPropertyName()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 booleanisActualProperty()A dynamic property is always considered actual - all keys are apparently existing with possibly the value of null.booleanisContainer()This type of node is auxiliary.voidremove()Remove the node of the object graph this pointer points to.private voidremoveKey()Remove the current property.voidsetPropertyIndex(int index)Index a property by its index in the list of all properties sorted alphabetically.voidsetPropertyName(java.lang.String propertyName)Select a property by name.voidsetValue(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, createChild, createChild, equals, getBean, getImmediateValuePointer, getLength, getName, hashCode, isActual, isCollection, isLeaf
-
Methods inherited from class org.apache.commons.jxpath.ri.model.NodePointer
attributeIterator, childIterator, clone, compareTo, createAttribute, escape, getAbstractFactory, getDefaultNamespaceURI, getImmediateParentPointer, getIndex, getLocale, getNamespaceResolver, getNamespaceURI, getNamespaceURI, getNode, getNodeSetByKey, getNodeValue, getParent, getPointerByID, getPointerByKey, getRootNode, getValue, getValuePointer, isAttribute, isDefaultNamespace, isLanguage, isNode, isRoot, namespaceIterator, namespacePointer, newChildNodePointer, newNodePointer, printPointerChain, setAttribute, setIndex, setNamespaceResolver, testNode, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
handler
private DynamicPropertyHandler handler
-
name
private java.lang.String name
-
names
private java.lang.String[] names
-
requiredPropertyName
private java.lang.String requiredPropertyName
-
-
Constructor Detail
-
DynamicPropertyPointer
public DynamicPropertyPointer(NodePointer parent, DynamicPropertyHandler handler)
Create a new DynamicPropertyPointer.- Parameters:
parent- pointerhandler- DynamicPropertyHandler
-
-
Method Detail
-
isContainer
public boolean isContainer()
This type of node is auxiliary.- Overrides:
isContainerin classNodePointer- Returns:
- true
-
getPropertyCount
public int getPropertyCount()
Number of the DP object's properties.- Specified by:
getPropertyCountin classPropertyPointer- Returns:
- int
-
getPropertyNames
public java.lang.String[] getPropertyNames()
Names of all properties, sorted alphabetically.- Specified by:
getPropertyNamesin classPropertyPointer- Returns:
- String[]
-
getPropertyName
public java.lang.String getPropertyName()
Returns the name of the currently selected property or "*" if none has been selected.- Specified by:
getPropertyNamein classPropertyPointer- Returns:
- String
-
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:
setPropertyNamein classPropertyPointer- Parameters:
propertyName- to set
-
getPropertyIndex
public int getPropertyIndex()
Index of the currently selected property in the list of all properties sorted alphabetically.- Overrides:
getPropertyIndexin classPropertyPointer- Returns:
- int
-
setPropertyIndex
public void setPropertyIndex(int index)
Index a property by its index in the list of all properties sorted alphabetically.- Overrides:
setPropertyIndexin classPropertyPointer- Parameters:
index- to set
-
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:
getBaseValuein classNodePointer- Returns:
- Object
-
getImmediateNode
public java.lang.Object getImmediateNode()
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:
getImmediateNodein classPropertyPointer- Returns:
- Object
-
isActualProperty
protected boolean isActualProperty()
A dynamic property is always considered actual - all keys are apparently existing with possibly the value of null.- Specified by:
isActualPropertyin classPropertyPointer- Returns:
- boolean
-
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:
setValuein interfacePointer- Specified by:
setValuein classNodePointer- Parameters:
value- to set
-
createPath
public NodePointer createPath(JXPathContext context)
Description copied from class:NodePointerCalled 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:
createPathin classPropertyPointer- Parameters:
context- the owning JXPathContext- Returns:
- created NodePointer
-
createPath
public NodePointer createPath(JXPathContext context, java.lang.Object value)
Description copied from class:NodePointerCalled directly by JXPathContext. Must create path and set value.- Overrides:
createPathin classPropertyPointer- Parameters:
context- the owning JXPathContextvalue- the new value to set- Returns:
- created NodePointer
-
remove
public void remove()
Description copied from class:NodePointerRemove the node of the object graph this pointer points to.- Overrides:
removein classNodePointer
-
removeKey
private void removeKey()
Remove the current property.
-
asPath
public java.lang.String asPath()
Description copied from class:NodePointerReturns an XPath that maps to this Pointer.- Specified by:
asPathin interfacePointer- Overrides:
asPathin classNodePointer- Returns:
- String xpath expression
-
-