Package org.exolab.adaptx.xpath
Class XPathResult
java.lang.Object
org.exolab.adaptx.xpath.XPathResult
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BooleanResult
,NodeSet
,NumberResult
,StringResult
,XSLTFunctionResult
Abstract class representing the result of an XPath expression.
An XPath result can be one of the following four types:
- A boolean result of type
BOOLEAN
represented by an object of typeBooleanResult
. - A string result of type
STRING
represented by an object of typeStringResult
. - A number result of type
NUMBER
represented by an object of typeNumberResult
. - A node-set result of type
NODE_SET
represented by an object of typeNodeSet
.
- Version:
- $Revision: 3633 $
- Author:
- Keith Visco, Assaf Arkin
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
An XPath result of type boolean.static final int
An XPath result of type node-set.static final int
An XPath result of type number.static final int
An XPath result of type string.static final int
An XPath result used for XPath extensions -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
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
Returns the type of this result.abstract Object
Returns the result as a Java object.abstract double
Returns the result as a number value.abstract String
Returns the result as a string value.
-
Field Details
-
BOOLEAN
public static final int BOOLEANAn XPath result of type boolean. Returned byBooleanResult
.- See Also:
-
NUMBER
public static final int NUMBERAn XPath result of type number. Returned byNumberResult
.- See Also:
-
STRING
public static final int STRINGAn XPath result of type string. Returned byStringResult
.- See Also:
-
NODE_SET
public static final int NODE_SETAn XPath result of type node-set. Returned byNodeSet
.- See Also:
-
USER_DEFINED
public static final int USER_DEFINEDAn XPath result used for XPath extensions- See Also:
-
-
Constructor Details
-
XPathResult
public XPathResult()
-
-
Method Details
-
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
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
Returns the result as a Java object. Returns an object of typeBoolean
for a boolean result, an object of typeString
for a string result, an object of typeDouble
for a number result, or an object of typeNodeSet
for a node-set.- Returns:
- The result as a Java object
-
equals
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
-