|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.value.Value
net.sf.saxon.value.AtomicValue
The AtomicValue class corresponds to the concept of an atomic value in the XPath 2.0 data model. Atomic values belong to one of the 19 primitive types defined in XML Schema; or they are of type xdt:untypedAtomic; or they are "external objects", representing a Saxon extension to the XPath 2.0 type system.
The AtomicValue class contains some methods that are suitable for applications to use, and many others that are designed for internal use by Saxon itself. These have not been fully classified. At present, therefore, none of the methods on this class should be considered to be part of the public Saxon API.
Field Summary |
Fields inherited from class net.sf.saxon.value.Value |
EMPTY_CLASS_ARRAY |
Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
EMPTY_VALUE_ARRAY |
Fields inherited from interface net.sf.saxon.expr.Expression |
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD |
Constructor Summary | |
AtomicValue()
|
Method Summary | |
void |
checkPermittedContents(SchemaType parentType,
StaticContext env,
boolean whole)
Check statically that the results of the expression are capable of constructing the content of a given schema type. |
AtomicValue |
convert(AtomicType targetType,
XPathContext context,
boolean validate)
Convert the value to a given type. |
AtomicValue |
convert(int requiredType,
XPathContext context)
Convert the value to a given type. |
abstract AtomicValue |
convertPrimitive(BuiltInAtomicType requiredType,
boolean validate,
XPathContext context)
Convert a value to another primitive data type, with control over how validation is handled. |
void |
display(int level,
NamePool pool,
java.io.PrintStream out)
Diagnostic print of expression structure |
boolean |
effectiveBooleanValue(XPathContext context)
Get the effective boolean value of the value |
java.lang.String |
evaluateAsString(XPathContext context)
Evaluate as a string |
Item |
evaluateItem(XPathContext context)
Evaluate the value (this simply returns the value unchanged) |
int |
getCardinality()
Determine the static cardinality |
AtomicValue |
getComponent(int component)
Method to extract components of a value. |
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). |
int |
getLength()
Get the length of the sequence |
AtomicValue |
getPrimitiveValue()
Get the primitive value (the value in the value space). |
abstract java.lang.String |
getStringValue()
Convert the value to a string, using the serialization rules. |
java.lang.CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence. |
SequenceIterator |
getTypedValue()
Get the typed value of this item |
boolean |
hasBuiltInType()
Test whether the type of this atomic value is a built-in type. |
SequenceIterator |
iterate(XPathContext context)
Iterate over the (single) item in the sequence |
void |
process(XPathContext context)
Process the instruction, without returning any tail calls |
boolean |
schemaEquals(Value obj)
Compare two values for equality. |
java.lang.String |
toString()
Get string value. |
Methods inherited from class net.sf.saxon.value.Value |
asItem, asIterator, asValue, collapseWhitespace, convert, convertJavaObjectToXPath, convertToJava, equals, getDependencies, getItemType, getIterator, getParentExpression, getSpecialProperties, hashCode, itemAt, iterateSubExpressions, makeQNameValue, normalizeWhitespace, optimize, promote, reduce, simplify, stringToNumber, trimWhitespace, typeCheck |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public AtomicValue()
Method Detail |
public boolean hasBuiltInType()
public int getImplementationMethod()
getImplementationMethod
in interface Expression
public void process(XPathContext context) throws XPathException
process
in interface Expression
process
in class Value
context
- The dynamic context, giving access to the current node,
the current variables, etc.
XPathException
public final int getCardinality()
getCardinality
in interface Expression
getCardinality
in class Value
Cardinality
public final AtomicValue convert(int requiredType, XPathContext context) throws XPathException
requiredType
- type code of the required atomic typecontext
-
XPathException
- if conversion is not allowed for this
required type, or if the particular value cannot be convertedpublic abstract AtomicValue convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
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.
public AtomicValue convert(AtomicType targetType, XPathContext context, boolean validate)
targetType
- the type to which the value is to be convertedcontext
- provides access to conversion contextvalidate
- true if validation is required, false if the caller already knows that the
value is valid
ValidationErrorValue
if conversion failed. The
caller must check for this condition. Validation may fail even if validation was not requested.public final int getLength()
getLength
in class Value
public Item evaluateItem(XPathContext context) throws XPathException
evaluateItem
in interface Expression
evaluateItem
in class Value
context
- the evaluation context (not used in this implementation)
XPathException
public final SequenceIterator iterate(XPathContext context)
iterate
in interface Expression
context
- the evaluation context (not used in this implementation)
public final java.lang.String evaluateAsString(XPathContext context)
evaluateAsString
in interface Expression
evaluateAsString
in class Value
context
- The context in which the expression is to be evaluated
public abstract java.lang.String getStringValue()
getStringValue
in interface Item
getStringValue
in class Value
public java.lang.CharSequence getStringValueCS()
getStringValueCS
in interface Item
Item.getStringValue()
public final SequenceIterator getTypedValue()
getTypedValue
in interface Item
public AtomicValue getPrimitiveValue()
Type.isPrimitiveType(int)
public boolean effectiveBooleanValue(XPathContext context) throws XPathException
effectiveBooleanValue
in interface Expression
effectiveBooleanValue
in class Value
context
- the evaluation context (not used in this implementation)
XPathException
- if any dynamic error occurs evaluating the
expressionpublic AtomicValue getComponent(int component) throws XPathException
XPathException
public void checkPermittedContents(SchemaType parentType, StaticContext env, boolean whole) throws XPathException
checkPermittedContents
in interface Expression
checkPermittedContents
in class Value
parentType
- The schema typeenv
- the static contextwhole
- true if this atomic value accounts for the entire content of the containing node
XPathException
- if the expression doesn't match the required content typepublic java.lang.String toString()
toString
in class Value
public boolean schemaEquals(Value obj)
schemaEquals
in class Value
public final void display(int level, NamePool pool, java.io.PrintStream out)
display
in interface Expression
display
in class Value
level
- the indentation level of the outputout
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |