org.exolab.adaptx.xpath

Class BooleanResult

Implemented Interfaces:
java.io.Serializable

public final class BooleanResult
extends XPathResult

Represents a boolean 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

static BooleanResult
FALSE
Boolean result representing false.
static BooleanResult
TRUE
Boolean result representing true.

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

BOOLEAN, NODE_SET, NUMBER, STRING, USER_DEFINED

Method Summary

boolean
booleanValue()
Returns the result as a boolean value.
boolean
equals(XPathResult result)
Returns true if the given result is a boolean result and has the same boolean value.
static BooleanResult
from(boolean value)
Returns a boolean result from a boolean value.
static BooleanResult
from(XPathResult result)
Returns a boolean result from an XPath result.
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()

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

booleanValue, equals, getResultType, javaObject, numberValue, stringValue

Field Details

FALSE

public static final BooleanResult FALSE
Boolean result representing false.

TRUE

public static final BooleanResult TRUE
Boolean result representing true.

Method Details

booleanValue

public boolean booleanValue()
Returns the result as a boolean value.
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 boolean result and has the same boolean value.
Overrides:
equals in interface XPathResult
Parameters:
result - An XPath result
Returns:
True if a boolean result and has same value

from

public static BooleanResult from(boolean value)
Returns a boolean result from a boolean value. Use this method in lieu of the constructor.
Parameters:
Returns:
A boolean result

from

public static BooleanResult from(XPathResult result)
Returns a boolean result from an XPath result. Return true if the XPath result is a numeric value that is not zero or java.lang.Double.NaN, a non-empty string, or a non-empty NodeSet.
Parameters:
result - An XPath result
Returns:
A boolean result

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 java.lang.Boolean with the same boolean 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 0 for false, 1 for true.
Overrides:
numberValue in interface XPathResult
Returns:
The result as a number value

stringValue

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

toString

public String toString()