Class DynamicPropertyPointer

All Implemented Interfaces:
Serializable, Cloneable, 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:
  • Field Details

  • Constructor Details

    • DynamicPropertyPointer

      public DynamicPropertyPointer(NodePointer parent, DynamicPropertyHandler handler)
      Create a new DynamicPropertyPointer.
      Parameters:
      parent - pointer
      handler - DynamicPropertyHandler
  • Method Details

    • isContainer

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

      public int getPropertyCount()
      Number of the DP object's properties.
      Specified by:
      getPropertyCount in class PropertyPointer
      Returns:
      int
    • getPropertyNames

      public String[] getPropertyNames()
      Names of all properties, sorted alphabetically.
      Specified by:
      getPropertyNames in class PropertyPointer
      Returns:
      String[]
    • getPropertyName

      public String getPropertyName()
      Returns the name of the currently selected property or "*" if none has been selected.
      Specified by:
      getPropertyName in class PropertyPointer
      Returns:
      String
    • setPropertyName

      public void setPropertyName(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
      Parameters:
      propertyName - to set
    • getPropertyIndex

      public int getPropertyIndex()
      Index of the currently selected property in the list of all properties sorted alphabetically.
      Overrides:
      getPropertyIndex in class PropertyPointer
      Returns:
      int
    • 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
      Parameters:
      index - to set
    • getBaseValue

      public 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
      Returns:
      Object
    • 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()
      A dynamic property is always considered actual - all keys are apparently existing with possibly the value of null.
      Specified by:
      isActualProperty in class PropertyPointer
      Returns:
      boolean
    • 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 - 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
    • createPath

      public NodePointer createPath(JXPathContext context, Object value)
      Description copied from class: NodePointer
      Called directly by JXPathContext. Must create path and set value.
      Overrides:
      createPath in class PropertyPointer
      Parameters:
      context - the owning JXPathContext
      value - the new value to set
      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
    • removeKey

      private void removeKey()
      Remove the current property.
    • asPath

      public 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
      Returns:
      String xpath expression