Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.jxpath.util
Class BasicTypeConverter.ValuePointer  view BasicTypeConverter.ValuePointer download BasicTypeConverter.ValuePointer.java

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

static final class BasicTypeConverter.ValuePointer
extends java.lang.Object
implements org.apache.commons.jxpath.Pointer


Field Summary
private  java.lang.Object bean
           
 
Constructor Summary
BasicTypeConverter.ValuePointer(java.lang.Object object)
           
 
Method Summary
 java.lang.String asPath()
          Returns a string that is a proper "canonical" XPath that corresponds to this pointer.
 java.lang.Object clone()
          Pointers are cloneable
 int compareTo(java.lang.Object object)
          Compares this object with another, and returns a numerical result based on the comparison.
 java.lang.Object getNode()
          Returns the raw value of the object, property or collection element this pointer represents.
 java.lang.Object getRootNode()
          Returns the node this pointer is based on.
 java.lang.Object getValue()
          Returns the value of the object, property or collection element this pointer represents.
 void setValue(java.lang.Object value)
          Modifies the value of the object, property or collection element this pointer represents.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bean

private java.lang.Object bean
Constructor Detail

BasicTypeConverter.ValuePointer

public BasicTypeConverter.ValuePointer(java.lang.Object object)
Method Detail

getValue

public java.lang.Object getValue()
Description copied from interface: org.apache.commons.jxpath.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 org.apache.commons.jxpath.Pointer

getNode

public java.lang.Object getNode()
Description copied from interface: org.apache.commons.jxpath.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 org.apache.commons.jxpath.Pointer

getRootNode

public java.lang.Object getRootNode()
Description copied from interface: org.apache.commons.jxpath.Pointer
Returns the node this pointer is based on.

Specified by:
getRootNode in interface org.apache.commons.jxpath.Pointer

setValue

public void setValue(java.lang.Object value)
Description copied from interface: org.apache.commons.jxpath.Pointer
Modifies the value of the object, property or collection element this pointer represents.

Specified by:
setValue in interface org.apache.commons.jxpath.Pointer

clone

public java.lang.Object clone()
Description copied from interface: org.apache.commons.jxpath.Pointer
Pointers are cloneable

Specified by:
clone in interface org.apache.commons.jxpath.Pointer

compareTo

public int compareTo(java.lang.Object object)
Description copied from interface: java.lang.Comparable
Compares this object with another, and returns a numerical result based on the comparison. If the result is negative, this object sorts less than the other; if 0, the two are equal, and if positive, this object sorts greater than the other. To translate this into boolean, simply perform o1.compareTo(o2) <op> 0, where op is one of <, <=, =, !=, >, or >=.

You must make sure that the comparison is mutual, ie. sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) (where sgn() is defined as -1, 0, or 1 based on the sign). This includes throwing an exception in either direction if the two are not comparable; hence, compareTo(null) should always throw an Exception.

You should also ensure transitivity, in two forms: x.compareTo(y) > 0 && y.compareTo(z) > 0 implies x.compareTo(z) > 0; and x.compareTo(y) == 0 implies x.compareTo(z) == y.compareTo(z).

Specified by:
compareTo in interface java.lang.Comparable

asPath

public java.lang.String asPath()
Description copied from interface: org.apache.commons.jxpath.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 org.apache.commons.jxpath.Pointer