com.novell.xml.xpath
Interface ExpressionValue

All Known Implementing Classes:
BooleanValue, JavaObject, JavaVoid, NodeSet, NumberValue, ResultTreeFragment, StringValue

public interface ExpressionValue

Interface allowing discovery of and access to expression values. Implementing classes must provide an argumentless constructor for use in casting expression types. For casting, the appropriate type is constructed, then the castFrom() member defined by this interface is called.


Field Summary
static int BOOLEAN
          Represents a boolean value
static int EXTENDED
          Represents a non-XPath defined type
static int NATIVE
          Represents a native (extension) type
static int NODE_SET
          Represents a node-set value
static int NUMBER
          Represents a number value
static int STRING
          Represents a string value
 
Method Summary
 void castFrom(Object type)
          Convert from a different type of expression value to the type of the class implementing the ExpressionValue interface.
 void dump(PrintWriter writer)
          Output a human-readable form for the value
 boolean getBooleanValue()
          Return boolean value of expression value (will convert to boolean if value is not of type boolean)
 Object getNativeValue()
          return the underlying native value (java.lang.Boolean, java.lang.Double, etc.)
 NodeSet getNodeSetValue()
          Return node-set value of this ExpressionValue.
 double getNumberValue()
          Return numeric value of ExpressionValue.
 String getStringValue()
          Return string value of this ExpressionValue.
 int getValueType()
          Return type of expression value
 

Field Detail

BOOLEAN

public static final int BOOLEAN
Represents a boolean value

See Also:
Constant Field Values

NUMBER

public static final int NUMBER
Represents a number value

See Also:
Constant Field Values

STRING

public static final int STRING
Represents a string value

See Also:
Constant Field Values

NODE_SET

public static final int NODE_SET
Represents a node-set value

See Also:
Constant Field Values

EXTENDED

public static final int EXTENDED
Represents a non-XPath defined type

See Also:
Constant Field Values

NATIVE

public static final int NATIVE
Represents a native (extension) type

See Also:
Constant Field Values
Method Detail

getValueType

public int getValueType()
Return type of expression value

Returns:
ExpressionValue.BOOLEAN, ExpressionValue.NUMBER, etc.

castFrom

public void castFrom(Object type)
              throws XPathConversionException
Convert from a different type of expression value to the type of the class implementing the ExpressionValue interface. This is used primarily for converting parameters for function calls. The XPath basic types (Boolean, Number, String, Node-set) use the required methods of ExpressionValue to perform this function. Extended types must implement this according to their language definitions.

Parameters:
type - The object to convert from.
Throws:
XPathConversionException

getBooleanValue

public boolean getBooleanValue()
                        throws XPathConversionException
Return boolean value of expression value (will convert to boolean if value is not of type boolean)

Returns:
true or false
Throws:
XPathConversionException

getNumberValue

public double getNumberValue()
                      throws XPathConversionException
Return numeric value of ExpressionValue. Will convert to a number if value is not of NUMBER type

Returns:
numeric value
Throws:
XPathConversionException

getStringValue

public String getStringValue()
Return string value of this ExpressionValue. Will convert to a string if underlying type is not string.

Returns:
String value of ExpressionValue

getNodeSetValue

public NodeSet getNodeSetValue()
                        throws XPathConversionException
Return node-set value of this ExpressionValue. Will NOT convert an underlying type to a node-set.

Throws:
XPathConversionException

getNativeValue

public Object getNativeValue()
return the underlying native value (java.lang.Boolean, java.lang.Double, etc.)

Returns:
The native java class that is the value

dump

public void dump(PrintWriter writer)
Output a human-readable form for the value

Parameters:
writer - Output device