jd.xml.xpath.object
Class XObject

java.lang.Object
  extended byjd.xml.xpath.object.XObject
Direct Known Subclasses:
XBoolean, XExternalObject, XNodeSet, XNumber, XString

public abstract class XObject
extends Object

XObject is the base class for the classes that represent objects of the four basic XPath types node-set, boolean, number and string.


Field Summary
static int TYPE_BOOLEAN
          The boolean type constant.
static int TYPE_NODESET
          The node-set type constant.
static int TYPE_NUMBER
          The number type constant.
static int TYPE_STRING
          The string type constant.
static int TYPE_VARIABLE
          A type constant for objects whose value depends on runtime contexts.
static int TYPES
          The number of existing types, the first type has code 0.
 
Constructor Summary
XObject()
           
 
Method Summary
abstract  int canConvertTo(Class javaClass)
          Test if the XObject can be converted to an object with the given class.
 boolean compare(Equality equality, boolean value)
          Return if this XObject equals the given value.
 boolean compare(Equality equality, double value)
          Return if this XObject equals the given value.
abstract  boolean compare(Equality equality, String value)
          Return if this XObject equals the given value.
 boolean compare(Equality equality, XObject object)
          Return if this XObject equals the given value.
 boolean compare(Relation relation, double value)
          Compare this XObject to the number value according the given relation.
 boolean compare(Relation relation, XObject object)
          Compare this XObject to the other object according the given relation.
 boolean equals(Object obj)
          Test if the given object equals this object.
abstract  int getType()
          Return the type code of this XObject.
 String getTypeName()
          Return the name of this objects type.
static String getTypeName(int type)
          Return the name of the type.
 int hashCode()
          Return a hashcode for this XObject.
abstract  boolean toBooleanValue()
          Convert the XObject to a boolean.
 XNodeSet toNodeSet()
          Convert the XObject to a NodeSet.
abstract  double toNumberValue()
          Convert the XObject to a double.
 String toString()
          Return a debug string representation of this XObject.
abstract  String toStringValue()
          Convert the XObject to a String.
abstract  Object toValue()
          Return the objects value as a java object.
abstract  Object toValue(Class javaClass)
          Convert the objects value to an object of the given class.
 XObject toXObject(int type)
          Convert the XObject to an XObject with the given type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_BOOLEAN

public static final int TYPE_BOOLEAN
The boolean type constant.

See Also:
getType(), Constant Field Values

TYPE_NUMBER

public static final int TYPE_NUMBER
The number type constant.

See Also:
getType(), Constant Field Values

TYPE_STRING

public static final int TYPE_STRING
The string type constant.

See Also:
getType(), Constant Field Values

TYPE_NODESET

public static final int TYPE_NODESET
The node-set type constant.

See Also:
getType(), Constant Field Values

TYPE_VARIABLE

public static final int TYPE_VARIABLE
A type constant for objects whose value depends on runtime contexts.

See Also:
getType(), Constant Field Values

TYPES

public static final int TYPES
The number of existing types, the first type has code 0.

See Also:
Constant Field Values
Constructor Detail

XObject

public XObject()
Method Detail

getType

public abstract int getType()
Return the type code of this XObject.


getTypeName

public final String getTypeName()
Return the name of this objects type.


getTypeName

public static String getTypeName(int type)
Return the name of the type.


toValue

public abstract Object toValue()
Return the objects value as a java object.


toValue

public abstract Object toValue(Class javaClass)
Convert the objects value to an object of the given class. If the conversion is not possible return null.


canConvertTo

public abstract int canConvertTo(Class javaClass)
Test if the XObject can be converted to an object with the given class.

Returns:
a positive integer if conversion is possible. The value indicates the conversion preference. A zero value indicates that conversion is not possible.

toBooleanValue

public abstract boolean toBooleanValue()
Convert the XObject to a boolean.


toNumberValue

public abstract double toNumberValue()
Convert the XObject to a double.


toStringValue

public abstract String toStringValue()
Convert the XObject to a String.


toNodeSet

public XNodeSet toNodeSet()
                   throws XPathException
Convert the XObject to a NodeSet.

Throws:
XPathException - thrown if the conversion is not possible

toXObject

public XObject toXObject(int type)
Convert the XObject to an XObject with the given type.

Throws:
XPathException - thrown if the conversion is not possible

compare

public abstract boolean compare(Equality equality,
                                String value)
Return if this XObject equals the given value.


compare

public boolean compare(Equality equality,
                       boolean value)
Return if this XObject equals the given value.


compare

public boolean compare(Equality equality,
                       double value)
Return if this XObject equals the given value.


compare

public boolean compare(Relation relation,
                       double value)
Compare this XObject to the number value according the given relation.


compare

public boolean compare(Equality equality,
                       XObject object)
Return if this XObject equals the given value.


compare

public boolean compare(Relation relation,
                       XObject object)
Compare this XObject to the other object according the given relation.


hashCode

public int hashCode()
Return a hashcode for this XObject.


equals

public boolean equals(Object obj)
Test if the given object equals this object.


toString

public String toString()
Return a debug string representation of this XObject.