Class BeanPropertyPointer

All Implemented Interfaces:
Serializable, Cloneable, Comparable, Pointer

public class BeanPropertyPointer extends PropertyPointer
Pointer pointing to a property of a JavaBean.
Version:
$Revision: 670727 $ $Date: 2008-06-23 15:10:38 -0500 (Mon, 23 Jun 2008) $
See Also:
  • Field Details

  • Constructor Details

    • BeanPropertyPointer

      public BeanPropertyPointer(NodePointer parent, JXPathBeanInfo beanInfo)
      Create a new BeanPropertyPointer.
      Parameters:
      parent - parent pointer
      beanInfo - describes the target property/ies.
  • Method Details

    • isContainer

      public boolean isContainer()
      This type of node is auxiliary.
      Overrides:
      isContainer in class NodePointer
      Returns:
      true
    • getPropertyCount

      public int getPropertyCount()
      Description copied from class: PropertyPointer
      Count the number of properties represented.
      Specified by:
      getPropertyCount in class PropertyPointer
      Returns:
      int
    • getPropertyNames

      public String[] getPropertyNames()
      Get the names of all properties, sorted alphabetically
      Specified by:
      getPropertyNames in class PropertyPointer
      Returns:
      String[]
    • setPropertyName

      public void setPropertyName(String propertyName)
      Select a property by name.
      Specified by:
      setPropertyName in class PropertyPointer
      Parameters:
      propertyName - String name
    • setPropertyIndex

      public void setPropertyIndex(int index)
      Selects a property by its offset in the alphabetically sorted list.
      Overrides:
      setPropertyIndex in class PropertyPointer
      Parameters:
      index - property index
    • getBaseValue

      public Object getBaseValue()
      Get the value of the currently selected property.
      Specified by:
      getBaseValue in class NodePointer
      Returns:
      Object value
    • setIndex

      public void setIndex(int index)
      Description copied from class: NodePointer
      Set the index of this NodePointer.
      Overrides:
      setIndex in class NodePointer
      Parameters:
      index - int
    • getImmediateNode

      public 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
      Returns:
      Object
    • isActualProperty

      protected boolean isActualProperty()
      Description copied from class: PropertyPointer
      Learn whether this pointer references an actual property.
      Specified by:
      isActualProperty in class PropertyPointer
      Returns:
      true if actual
    • 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
      Returns:
      boolean
    • getLength

      public int getLength()
      If the property contains a collection, then the length of that collection, otherwise - 1.
      Overrides:
      getLength in class PropertyPointer
      Returns:
      int length
    • setValue

      public void setValue(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
      Parameters:
      value - value to set
    • 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
      Parameters:
      context - the owning JXPathContext
      Returns:
      created 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
    • getPropertyName

      public String getPropertyName()
      Get the name of the currently selected property.
      Specified by:
      getPropertyName in class PropertyPointer
      Returns:
      String property name
    • getPropertyDescriptor

      private PropertyDescriptor getPropertyDescriptor()
      Finds the property descriptor corresponding to the current property index.
      Returns:
      PropertyDescriptor
    • getPropertyDescriptors

      protected PropertyDescriptor[] getPropertyDescriptors()
      Get all PropertyDescriptors.
      Returns:
      PropertyDescriptor[]