Class ObjectValue
java.lang.Object
net.sf.saxon.value.Value
net.sf.saxon.value.AtomicValue
net.sf.saxon.value.ObjectValue
- All Implemented Interfaces:
Serializable, Expression, Item, ValueRepresentation
- Direct Known Subclasses:
ValidationErrorValue
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:
-
Field Summary
Fields inherited from class Value
EMPTY_CLASS_ARRAYFields inherited from interface Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHODFields inherited from interface ValueRepresentation
EMPTY_VALUE_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for use in subclassesObjectValue(Object object) Constructor -
Method Summary
Modifier and TypeMethodDescriptionconvertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) Convert to target data typeconvertToJava(Class target, XPathContext context) Convert to Java object (for passing to external functions)booleaneffectiveBooleanValue(XPathContext context) Get the effective boolean value of the valuebooleanDetermine if two ObjectValues are equalDetermine the data type of the expressionGet the encapsulated objectGet the value as a StringinthashCode()Return a hash code to support the equals() functionvoidSet the value in this object valueMethods inherited from class AtomicValue
checkPermittedContents, convert, convert, display, evaluateAsString, evaluateItem, getCardinality, getComponent, getImplementationMethod, getLength, getPrimitiveValue, getStringValueCS, getTypedValue, hasBuiltInType, iterate, process, toStringMethods inherited from class Value
asItem, asIterator, asValue, convert, convertJavaObjectToXPath, getDependencies, getIterator, getParentExpression, getSpecialProperties, itemAt, iterateSubExpressions, makeQNameValue, optimize, promote, reduce, simplify, stringToNumber, typeCheck
-
Constructor Details
-
ObjectValue
public ObjectValue()Default constructor for use in subclasses -
ObjectValue
-
-
Method Details
-
setValue
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
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:
-
effectiveBooleanValue
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
Determine the data type of the expression- Specified by:
getItemTypein interfaceExpression- Overrides:
getItemTypein classValue- Parameters:
th-- Returns:
- Type.OBJECT
-
getObject
Get the encapsulated object -
equals
Determine if two ObjectValues are equal- Overrides:
equalsin classValue- Throws:
ClassCastException- if they are not comparable
-
hashCode
-
convertToJava
Convert to Java object (for passing to external functions)- Overrides:
convertToJavain classValue- Throws:
XPathException
-