|
|||||||
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
public abstract class 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 xs: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, INDETERMINATE_ORDERING |
Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
---|
EMPTY_VALUE_ARRAY |
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(BuiltInAtomicType schemaType,
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. |
abstract AtomicValue |
copy(AtomicType typeLabel)
Create a copy of this atomic value, with a different type label |
boolean |
effectiveBooleanValue()
Get the effective boolean value of the value |
int |
getCardinality()
Determine the static cardinality |
AtomicValue |
getComponent(int component)
Method to extract components of a value. |
ItemType |
getItemType(TypeHierarchy th)
Determine the data type of the items in the expression, if possible |
int |
getLength()
Get the length of the sequence |
abstract BuiltInAtomicType |
getPrimitiveType()
Determine the primitive type of the value. |
abstract String |
getStringValue()
Convert the value to a string, using the serialization rules. |
CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence. |
SequenceIterator |
getTypedValue()
Get the typed value of this item |
AtomicType |
getTypeLabel()
Determine the data type of the value. |
Comparable |
getXPathComparable()
Get a Comparable value that implements the XPath ordering comparison semantics for this value. |
boolean |
hasBuiltInType()
Test whether the type of this atomic value is a built-in type. |
boolean |
isMultiValued()
Determine whether the value is multivalued, that is, whether it is a sequence that potentially contains more than one item |
Item |
itemAt(int n)
Get the n'th item in the sequence (starting from 0). |
SequenceIterator |
iterate()
Iterate over the (single) item in the sequence |
void |
process(XPathContext context)
Process the instruction, without returning any tail calls |
void |
setTypeLabel(AtomicType type)
Set the type label on this atomic value |
String |
toString()
Get string value. |
Methods inherited from class net.sf.saxon.value.Value |
---|
asItem, asItem, asIterator, asValue, compareTo, convert, convertJavaObjectToXPath, convertToJava, equals, fromItem, getCanonicalLexicalRepresentation, getIterator, getSchemaComparable, hashCode, iterate, makeQNameValue, reduce, stringToNumber |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AtomicValue()
Method Detail |
---|
public void setTypeLabel(AtomicType type)
public boolean isMultiValued()
isMultiValued
in class Value
public boolean hasBuiltInType()
public Comparable getXPathComparable()
public CharSequence getStringValueCS()
getStringValueCS
in interface Item
getStringValueCS
in interface ValueRepresentation
getStringValueCS
in class Value
Item.getStringValue()
public void process(XPathContext context) throws XPathException
process
in class Value
context
- The dynamic context, giving access to the current node,
the current variables, etc.
XPathException
public Item itemAt(int n) throws XPathException
itemAt
in class Value
n
- position of the required item, counting from zero.
XPathException
public ItemType getItemType(TypeHierarchy th)
getItemType
in class Value
th
- The TypeHierarchy. Can be null if the target is an AtomicValue,
except in the case where it is an external ObjectValue.
public AtomicType getTypeLabel()
getItemType(net.sf.saxon.type.TypeHierarchy)
, except in the case of external objects
(instances of ObjectValue
, where the method may deliver a less specific type.
public abstract BuiltInAtomicType getPrimitiveType()
public final int getCardinality()
getCardinality
in class Value
Cardinality
public final AtomicValue convert(BuiltInAtomicType schemaType, XPathContext context) throws XPathException
schemaType
- 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
xs:Name or similar types: it determines the NameChecker to be used.
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 abstract AtomicValue copy(AtomicType typeLabel)
typeLabel
- the type label of the new copy. The caller is responsible for checking that
the value actually conforms to this type.public final int getLength()
getLength
in class Value
public final SequenceIterator iterate()
iterate
in class Value
public abstract String getStringValue()
getStringValue
in interface Item
getStringValue
in interface ValueRepresentation
getStringValue
in class Value
Item.getStringValueCS()
public final SequenceIterator getTypedValue()
getTypedValue
in interface Item
public boolean effectiveBooleanValue() throws XPathException
effectiveBooleanValue
in class Value
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 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 String toString()
toString
in class Value
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |