org.exolab.adaptx.xpath

Class BooleanResult

public final class BooleanResult extends XPathResult

Represents a boolean result. This is an immutable object.

Version: $Revision: 3633 $ $Date: 2003-03-01 02:38:44 -0500 (Sat, 01 Mar 2003) $

Author: Keith Visco

Field Summary
static BooleanResultFALSE
Boolean result representing false.
static BooleanResultTRUE
Boolean result representing true.
Method Summary
booleanbooleanValue()
Returns the result as a boolean value.
booleanequals(XPathResult result)
Returns true if the given result is a boolean result and has the same boolean value.
static BooleanResultfrom(boolean value)
Returns a boolean result from a boolean value.
static BooleanResultfrom(XPathResult result)
Returns a boolean result from an XPath result.
intgetResultType()
Returns the type of this result.
ObjectjavaObject()
Returns the result as a Java object.
doublenumberValue()
Returns the result as a number value.
StringstringValue()
Returns the result as a string value.
StringtoString()

Field Detail

FALSE

public static final BooleanResult FALSE
Boolean result representing false.

TRUE

public static final BooleanResult TRUE
Boolean result representing true.

Method Detail

booleanValue

public boolean booleanValue()
Returns the result as a boolean value.

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.

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: boolean The boolean value

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.

Returns: BOOLEAN

javaObject

public Object javaObject()
Returns the result as a Java object. Returns an object of type java.lang.Boolean with the same boolean value.

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.

Returns: The result as a number value

stringValue

public String stringValue()
Returns the result as a string value. Returns "false" or "true".

Returns: The result as a string value

toString

public String toString()