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

java.lang.Object
  extended byorg.apache.commons.jxpath.ri.model.NodePointer
      extended byorg.apache.commons.jxpath.ri.model.beans.PropertyPointer
          extended byorg.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, Pointer, java.io.Serializable

public class BeanPropertyPointer
extends PropertyPointer

Pointer pointing to a property of a JavaBean.

Version:
$Revision: 1.17 $ $Date: 2004/04/04 22:06:36 $
Author:
Dmitri Plotnikov
See Also:
Serialized Form

Field Summary
private  java.lang.Object baseValue
           
private  JXPathBeanInfo beanInfo
           
private  java.lang.String[] names
           
private  java.beans.PropertyDescriptor propertyDescriptor
           
private  java.beans.PropertyDescriptor[] propertyDescriptors
           
private  java.lang.String propertyName
           
private static java.lang.Object UNINITIALIZED
           
private static int UNKNOWN_LENGTH_MAX_COUNT
           
private  java.lang.Object value
           
 
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
BeanPropertyPointer(NodePointer parent, JXPathBeanInfo beanInfo)
           
 
Method Summary
 NodePointer createPath(JXPathContext context)
          Called by a child pointer when it needs to create a parent object.
 java.lang.Object getBaseValue()
          The value of the currently selected property.
 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.
 int getLength()
          If the property contains a collection, then the length of that collection, otherwise - 1.
 int getPropertyCount()
          Number of the bean's properties.
private  java.beans.PropertyDescriptor getPropertyDescriptor()
          Finds the property descriptor corresponding to the current property index.
protected  java.beans.PropertyDescriptor[] getPropertyDescriptors()
           
 java.lang.String getPropertyName()
          Name of the currently selected property.
 java.lang.String[] getPropertyNames()
          Names of all properties, sorted alphabetically
protected  boolean isActualProperty()
           
 boolean isCollection()
          Returns true if the value of the pointer is an array or a Collection.
 boolean isContainer()
          This type of node is auxiliary.
 void remove()
          Remove the node of the object graph this pointer points to.
 void setIndex(int index)
           
 void setPropertyIndex(int index)
          Selects a property by its offset in the alphabetically sorted list.
 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, createChild, createChild, createPath, equals, getBean, getImmediateValuePointer, getName, getPropertyIndex, hashCode, isActual, isLeaf
 
Methods inherited from class org.apache.commons.jxpath.ri.model.NodePointer
asPath, attributeIterator, childIterator, clone, compareTo, createAttribute, getDefaultNamespaceURI, getImmediateParentPointer, getIndex, getLocale, getNamespaceResolver, getNamespaceURI, getNamespaceURI, getNode, getNodeValue, getParent, getPointerByID, getPointerByKey, getRootNode, getValue, getValuePointer, isAttribute, isDefaultNamespace, isLanguage, isNode, isRoot, namespaceIterator, namespacePointer, newChildNodePointer, newNodePointer, printPointerChain, setAttribute, setNamespaceResolver, testNode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

propertyName

private java.lang.String propertyName

beanInfo

private JXPathBeanInfo beanInfo

propertyDescriptors

private java.beans.PropertyDescriptor[] propertyDescriptors

propertyDescriptor

private java.beans.PropertyDescriptor propertyDescriptor

names

private java.lang.String[] names

UNINITIALIZED

private static final java.lang.Object UNINITIALIZED

baseValue

private java.lang.Object baseValue

value

private java.lang.Object value

UNKNOWN_LENGTH_MAX_COUNT

private static final int UNKNOWN_LENGTH_MAX_COUNT
See Also:
Constant Field Values
Constructor Detail

BeanPropertyPointer

public BeanPropertyPointer(NodePointer parent,
                           JXPathBeanInfo beanInfo)
Method Detail

isContainer

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

Overrides:
isContainer in class NodePointer

getPropertyCount

public int getPropertyCount()
Number of the bean'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

setPropertyName

public void setPropertyName(java.lang.String propertyName)
Select a property by name

Specified by:
setPropertyName in class PropertyPointer

setPropertyIndex

public void setPropertyIndex(int index)
Selects a property by its offset in the alphabetically sorted list.

Overrides:
setPropertyIndex in class PropertyPointer

getBaseValue

public java.lang.Object getBaseValue()
The value of the currently selected property.

Specified by:
getBaseValue in class NodePointer

setIndex

public void setIndex(int index)
Overrides:
setIndex in class NodePointer

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:
getImmediateNode in class PropertyPointer

isActualProperty

protected boolean isActualProperty()
Specified by:
isActualProperty in class PropertyPointer

isCollection

public boolean isCollection()
Description copied from class: NodePointer
Returns true if the value of the pointer is an array or a Collection.

Overrides:
isCollection 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 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)
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 PropertyPointer
See Also:
PropertyPointer.createPath(JXPathContext)

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

getPropertyName

public java.lang.String getPropertyName()
Name of the currently selected property.

Specified by:
getPropertyName in class PropertyPointer

getPropertyDescriptor

private java.beans.PropertyDescriptor getPropertyDescriptor()
Finds the property descriptor corresponding to the current property index.


getPropertyDescriptors

protected java.beans.PropertyDescriptor[] getPropertyDescriptors()