Class BasicTypeConverter.ValuePointer

java.lang.Object
org.apache.commons.jxpath.util.BasicTypeConverter.ValuePointer
All Implemented Interfaces:
Serializable, Cloneable, Comparable, Pointer
Enclosing class:
BasicTypeConverter

static final class BasicTypeConverter.ValuePointer extends Object implements Pointer
Value pointer
  • Field Details

  • Constructor Details

    • ValuePointer

      public ValuePointer(Object object)
      Create a new ValuePointer.
      Parameters:
      object - value
  • Method Details

    • getValue

      public Object getValue()
      Description copied from interface: Pointer
      Returns the value of the object, property or collection element this pointer represents. May convert the value to one of the canonical InfoSet types: String, Number, Boolean, Set. For example, in the case of an XML element, getValue() will return the text contained by the element rather than the element itself.
      Specified by:
      getValue in interface Pointer
      Returns:
      Object value
    • getNode

      public Object getNode()
      Description copied from interface: Pointer
      Returns the raw value of the object, property or collection element this pointer represents. Never converts the object to a canonical type: returns it as is. For example, for an XML element, getNode() will return the element itself rather than the text it contains.
      Specified by:
      getNode in interface Pointer
      Returns:
      Object node
    • getRootNode

      public Object getRootNode()
      Description copied from interface: Pointer
      Returns the node this pointer is based on.
      Specified by:
      getRootNode in interface Pointer
      Returns:
      Object
    • setValue

      public void setValue(Object value)
      Description copied from interface: Pointer
      Modifies the value of the object, property or collection element this pointer represents.
      Specified by:
      setValue in interface Pointer
      Parameters:
      value - value to set
    • clone

      public Object clone()
      Description copied from interface: Pointer
      Pointers are cloneable.
      Specified by:
      clone in interface Pointer
      Overrides:
      clone in class Object
      Returns:
      cloned Object
    • compareTo

      public int compareTo(Object object)
      Specified by:
      compareTo in interface Comparable
    • asPath

      public String asPath()
      Description copied from interface: Pointer
      Returns a string that is a proper "canonical" XPath that corresponds to this pointer. Consider this example:

      Pointer ptr = ctx.getPointer("//employees[firstName = 'John']")

      The value of ptr.asPath() will look something like "/departments[2]/employees[3]", so, basically, it represents the concrete location(s) of the result of a search performed by JXPath. If an object in the pointer's path is a Dynamic Property object (like a Map), the asPath method generates an XPath that looks like this: " /departments[@name = 'HR']/employees[3]".

      Specified by:
      asPath in interface Pointer
      Returns:
      String path