Package net.sf.saxon.value
Class ObjectValue
- java.lang.Object
-
- net.sf.saxon.value.Value
-
- net.sf.saxon.value.AtomicValue
-
- net.sf.saxon.value.ObjectValue
-
- All Implemented Interfaces:
java.io.Serializable,Expression,Item,ValueRepresentation
- Direct Known Subclasses:
ValidationErrorValue
public class ObjectValue extends AtomicValue
An XPath value that encapsulates a Java object. Such a value can only be obtained by calling an extension function that returns it.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.value.Value
EMPTY_CLASS_ARRAY
-
Fields inherited from interface net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
-
Fields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY
-
-
Constructor Summary
Constructors Constructor Description ObjectValue()Default constructor for use in subclassesObjectValue(java.lang.Object object)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomicValueconvertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)Convert to target data typejava.lang.ObjectconvertToJava(java.lang.Class target, XPathContext context)Convert to Java object (for passing to external functions)booleaneffectiveBooleanValue(XPathContext context)Get the effective boolean value of the valuebooleanequals(java.lang.Object other)Determine if two ObjectValues are equalItemTypegetItemType(TypeHierarchy th)Determine the data type of the expressionjava.lang.ObjectgetObject()Get the encapsulated objectjava.lang.StringgetStringValue()Get the value as a StringinthashCode()Return a hash code to support the equals() functionvoidsetValue(java.lang.Object value)Set the value in this object value-
Methods inherited from class net.sf.saxon.value.AtomicValue
checkPermittedContents, convert, convert, display, evaluateAsString, evaluateItem, getCardinality, getComponent, getImplementationMethod, getLength, getPrimitiveValue, getStringValueCS, getTypedValue, hasBuiltInType, iterate, process, toString
-
Methods inherited from class net.sf.saxon.value.Value
asItem, asIterator, asValue, convert, convertJavaObjectToXPath, getDependencies, getIterator, getParentExpression, getSpecialProperties, itemAt, iterateSubExpressions, makeQNameValue, optimize, promote, reduce, simplify, stringToNumber, typeCheck
-
-
-
-
Method Detail
-
setValue
public void setValue(java.lang.Object value)
Set the value in this object value
-
convertPrimitive
public AtomicValue convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
Convert to target data type- Specified by:
convertPrimitivein classAtomicValue- Parameters:
requiredType- type code of the required atomic typevalidate- true if validation is required. If set to false, the caller guarantees that the value is valid for the target data type, and that further validation is therefore not required. Note that a validation failure may be reported even if validation was not requested.context- The conversion context to be used. This is required at present only when converting to a date or time: it provides the implicit timezone.- Returns:
- the result of the conversion, if successful. If unsuccessful, the value returned will be a ValidationErrorValue. The caller must check for this condition. No exception is thrown, instead the exception will be encapsulated within the ValidationErrorValue.
-
getStringValue
public java.lang.String getStringValue()
Get the value as a String- Specified by:
getStringValuein interfaceItem- Specified by:
getStringValuein interfaceValueRepresentation- Specified by:
getStringValuein classAtomicValue- Returns:
- a String representation of the value
- See Also:
Item.getStringValueCS()
-
effectiveBooleanValue
public boolean effectiveBooleanValue(XPathContext context) throws XPathException
Get the effective boolean value of the value- Specified by:
effectiveBooleanValuein interfaceExpression- Overrides:
effectiveBooleanValuein classAtomicValue- Parameters:
context- the evaluation context (not used in this implementation)- Returns:
- true, unless the value is boolean false, numeric zero, or zero-length string
- Throws:
XPathException- if any dynamic error occurs evaluating the expression
-
getItemType
public ItemType getItemType(TypeHierarchy th)
Determine the data type of the expression- Specified by:
getItemTypein interfaceExpression- Overrides:
getItemTypein classValue- Parameters:
th-- Returns:
- Type.OBJECT
-
getObject
public java.lang.Object getObject()
Get the encapsulated object
-
equals
public boolean equals(java.lang.Object other)
Determine if two ObjectValues are equal
-
hashCode
public int hashCode()
Description copied from class:ValueReturn a hash code to support the equals() function
-
convertToJava
public java.lang.Object convertToJava(java.lang.Class target, XPathContext context) throws XPathExceptionConvert to Java object (for passing to external functions)- Overrides:
convertToJavain classValue- Throws:
XPathException
-
-