Package org.exolab.adaptx.xpath
Class StringResult
- java.lang.Object
-
- org.exolab.adaptx.xpath.XPathResult
-
- org.exolab.adaptx.xpath.StringResult
-
- All Implemented Interfaces:
java.io.Serializable
public final class StringResult extends XPathResult
Represents a string result. This is an immutable object.- Version:
- $Revision: 3633 $ $Date: 2003-03-01 08:38:44 +0100 (Sat, 01 Mar 2003) $
- Author:
- Keith Visco
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringResult
EMPTY
String result representing an empty string.-
Fields inherited from class org.exolab.adaptx.xpath.XPathResult
BOOLEAN, NODE_SET, NUMBER, STRING, USER_DEFINED
-
-
Constructor Summary
Constructors Constructor Description StringResult()
Creates a new string result with an empty string as it's value.StringResult(java.lang.String value)
Creates a new string result with the given value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
booleanValue()
Returns the result as a boolean value.boolean
equals(XPathResult result)
Returns true if the given result is a string result and has the same string value.int
getResultType()
Returns the type of this result.java.lang.Object
javaObject()
Returns the result as a Java object.double
numberValue()
Returns the result as a number value.java.lang.String
stringValue()
Returns the result as a string value.java.lang.String
toString()
Returns the String representation of this XPathResult
-
-
-
Field Detail
-
EMPTY
public static final StringResult EMPTY
String result representing an empty string.
-
-
Method Detail
-
getResultType
public int getResultType()
Returns the type of this result.- Specified by:
getResultType
in classXPathResult
- Returns:
XPathResult.STRING
-
booleanValue
public boolean booleanValue()
Returns the result as a boolean value. Returns true if not an empty string.- Specified by:
booleanValue
in classXPathResult
- Returns:
- The result as a boolean value
-
numberValue
public double numberValue()
Returns the result as a number value. ReturnsDouble.NaN
if the value is not a valid number.- Specified by:
numberValue
in classXPathResult
- Returns:
- The result as a number value
-
stringValue
public java.lang.String stringValue()
Returns the result as a string value.- Specified by:
stringValue
in classXPathResult
- Returns:
- The result as a string value
-
javaObject
public java.lang.Object javaObject()
Returns the result as a Java object. Returns an object of typeString
with the same string value.- Specified by:
javaObject
in classXPathResult
- Returns:
- The result as a Java object
-
equals
public boolean equals(XPathResult result)
Returns true if the given result is a string result and has the same string value.- Specified by:
equals
in classXPathResult
- Parameters:
result
- An XPath result- Returns:
- True if a string result and has same value
-
toString
public java.lang.String toString()
Returns the String representation of this XPathResult- Overrides:
toString
in classjava.lang.Object
- Returns:
- the String representation of this XPathResult
-
-