jd.xml.xpath.object
Class XString

java.lang.Object
  extended byjd.xml.xpath.object.XObject
      extended byjd.xml.xpath.object.XString

public class XString
extends XObject

XString represents a XPath object with type string.


Field Summary
 
Fields inherited from class jd.xml.xpath.object.XObject
TYPE_BOOLEAN, TYPE_NODESET, TYPE_NUMBER, TYPE_STRING, TYPE_VARIABLE, TYPES
 
Constructor Summary
XString(String value)
          Create a XString.
 
Method Summary
 int canConvertTo(Class javaClass)
          Test if the XObject can be converted to an object with the given class.
 boolean compare(Equality equality, String value)
          Return if this XObject equals the given value.
 int getType()
          Return XObject.TYPE_STRING
 boolean toBooleanValue()
          Return true iff the string value has positive length.
static boolean toBooleanValue(String s)
          Return true iff the string value has positive length.
static Character toCharacterValue(String value)
          Convert a string to a character.
 double toNumberValue()
          Return the number value of the string.
static double toNumberValue(String in)
          Convert a string into a double
 String toString()
          Return a debug string representation of this XObject.
 String toStringValue()
          Return the string value.
 Object toValue()
          Return the string value.
 Object toValue(Class javaClass)
          Convert the objects value to an object of the given class.
 
Methods inherited from class jd.xml.xpath.object.XObject
compare, compare, compare, compare, compare, equals, getTypeName, getTypeName, hashCode, toNodeSet, toXObject
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XString

public XString(String value)
Create a XString.

Parameters:
value - the string value
Method Detail

getType

public int getType()
Return XObject.TYPE_STRING

Specified by:
getType in class XObject

toValue

public Object toValue()
Return the string value.

Specified by:
toValue in class XObject

toValue

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

Specified by:
toValue in class XObject

canConvertTo

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

Specified by:
canConvertTo in class XObject
Returns:
a positive integer if conversion is possible. The value indicates the conversion preference. A zero value indicates that conversion is not possible.

toCharacterValue

public static Character toCharacterValue(String value)
                                  throws XPathException
Convert a string to a character.

Throws:
XPathException - if the string hsa not a length of one

toBooleanValue

public boolean toBooleanValue()
Return true iff the string value has positive length.

Specified by:
toBooleanValue in class XObject

toBooleanValue

public static boolean toBooleanValue(String s)
Return true iff the string value has positive length.


toNumberValue

public double toNumberValue()
Return the number value of the string.

Specified by:
toNumberValue in class XObject

toNumberValue

public static double toNumberValue(String in)
Convert a string into a double

Returns:
the number or Double.NaN if the string could not be CONVERTED

toStringValue

public String toStringValue()
Return the string value.

Specified by:
toStringValue in class XObject

toString

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

Overrides:
toString in class XObject

compare

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

Specified by:
compare in class XObject