org.exolab.adaptx.xpath

Class StringResult

Implemented Interfaces:
java.io.Serializable

public final class StringResult
extends XPathResult

Represents a string result. This is an immutable object.
Version:
$Revision: 1.1.1.1 $ $Date: 2003/03/01 07:39:36 $
Author:
Keith Visco
See Also:
Serialized Form

Field Summary

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

StringResult()
Creates a new string result with an empty string as it's value.
StringResult(String value)
Creates a new string result with the given value.

Method Summary

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.
Object
javaObject()
Returns the result as a Java object.
double
numberValue()
Returns the result as a number value.
String
stringValue()
Returns the result as a string value.
String
toString()
Returns the String representation of this XPathResult

Methods inherited from class org.exolab.adaptx.xpath.XPathResult

booleanValue, equals, getResultType, javaObject, numberValue, stringValue

Field Details

EMPTY

public static final StringResult EMPTY
String result representing an empty string.

Constructor Details

StringResult

public StringResult()
Creates a new string result with an empty string as it's value.

StringResult

public StringResult(String value)
Creates a new string result with the given value.
Parameters:
value - The string value (not null)

Method Details

booleanValue

public boolean booleanValue()
Returns the result as a boolean value. Returns true if not an empty string.
Overrides:
booleanValue in interface XPathResult
Returns:
The result as a boolean value

equals

public boolean equals(XPathResult result)
Returns true if the given result is a string result and has the same string value.
Overrides:
equals in interface XPathResult
Parameters:
result - An XPath result
Returns:
True if a string result and has same value

getResultType

public int getResultType()
Returns the type of this result.
Overrides:
getResultType in interface XPathResult

javaObject

public Object javaObject()
Returns the result as a Java object. Returns an object of type String with the same string value.
Overrides:
javaObject in interface XPathResult
Returns:
The result as a Java object

numberValue

public double numberValue()
Returns the result as a number value. Returns java.lang.Double.NaN if the value is not a valid number.
Overrides:
numberValue in interface XPathResult
Returns:
The result as a number value

stringValue

public String stringValue()
Returns the result as a string value.
Overrides:
stringValue in interface XPathResult
Returns:
The result as a string value

toString

public String toString()
Returns the String representation of this XPathResult
Returns:
the String representation of this XPathResult