org.exolab.adaptx.xpath
Class XPathResult

java.lang.Object
  extended by org.exolab.adaptx.xpath.XPathResult
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
BooleanResult, NodeSet, NumberResult, StringResult, XSLTFunctionResult

public abstract class XPathResult
extends java.lang.Object
implements java.io.Serializable

Abstract class representing the result of an XPath expression. An XPath result can be one of the following four types:

Version:
$Revision: 3633 $
Author:
Keith Visco, Assaf Arkin
See Also:
Serialized Form

Field Summary
static int BOOLEAN
          An XPath result of type boolean.
static int NODE_SET
          An XPath result of type node-set.
static int NUMBER
          An XPath result of type number.
static int STRING
          An XPath result of type string.
static int USER_DEFINED
          An XPath result used for XPath extensions
 
Constructor Summary
XPathResult()
           
 
Method Summary
abstract  boolean booleanValue()
          Returns the result as a boolean value.
abstract  boolean equals(XPathResult result)
          Returns true if the given expression is the same tyoe as this result and has the same value as this result.
abstract  int getResultType()
          Returns the type of this result.
abstract  java.lang.Object javaObject()
          Returns the result as a Java object.
abstract  double numberValue()
          Returns the result as a number value.
abstract  java.lang.String stringValue()
          Returns the result as a string value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOLEAN

public static final int BOOLEAN
An XPath result of type boolean. Returned by BooleanResult.

See Also:
Constant Field Values

NUMBER

public static final int NUMBER
An XPath result of type number. Returned by NumberResult.

See Also:
Constant Field Values

STRING

public static final int STRING
An XPath result of type string. Returned by StringResult.

See Also:
Constant Field Values

NODE_SET

public static final int NODE_SET
An XPath result of type node-set. Returned by NodeSet.

See Also:
Constant Field Values

USER_DEFINED

public static final int USER_DEFINED
An XPath result used for XPath extensions

See Also:
Constant Field Values
Constructor Detail

XPathResult

public XPathResult()
Method Detail

getResultType

public abstract int getResultType()
Returns the type of this result.

Returns:
The type of this result

booleanValue

public abstract boolean booleanValue()
Returns the result as a boolean value. Returns the value of a boolean result, true for a non-empty string result, true for a non-zero number result, and true from a non-empty node-set.

Returns:
The result as a boolean value

numberValue

public abstract double numberValue()
Returns the result as a number value. Returns 0 or 1 for a boolean result, the parsed value for a string result, the value of a number result, or the parsed value of a node-set.

Returns:
The result as a number value

stringValue

public abstract java.lang.String stringValue()
Returns the result as a string value. Returns "false" or "true" for a boolean result, the value of a string result, the string value of a number result, or the string value of a node-set.

Returns:
The result as a string value

javaObject

public abstract java.lang.Object javaObject()
Returns the result as a Java object. Returns an object of type Boolean for a boolean result, an object of type String for a string result, an object of type Double for a number result, or an object of type NodeSet for a node-set.

Returns:
The result as a Java object

equals

public abstract boolean equals(XPathResult result)
Returns true if the given expression is the same tyoe as this result and has the same value as this result.

Parameters:
result - An XPath result
Returns:
True if same type and same value as this result