|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.value.Value
public abstract class Value
A value is the result of an expression but it is also an expression in its own right. Note that every value can be regarded as a sequence - in many cases, a sequence of length one.
Field Summary | |
---|---|
static Class[] |
EMPTY_CLASS_ARRAY
|
static int |
INDETERMINATE_ORDERING
Constant returned by compareTo() method to indicate an indeterminate ordering between two values |
Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
---|
EMPTY_VALUE_ARRAY |
Constructor Summary | |
---|---|
Value()
|
Method Summary | |
---|---|
Item |
asItem()
Return the value in the form of an Item |
static Item |
asItem(ValueRepresentation value)
Static method to make an Item from a Value |
static SequenceIterator |
asIterator(ValueRepresentation val)
Static method to get an Iterator over any ValueRepresentation (which may be either a Value or a NodeInfo |
static Value |
asValue(ValueRepresentation val)
Static method to make a Value from a given Item (which may be either an AtomicValue or a NodeInfo |
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. |
static Value |
convertJavaObjectToXPath(Object object,
SequenceType requiredType,
XPathContext context)
Convert a Java object to an XPath value. |
Object |
convertToJava(Class target,
XPathContext context)
Convert to Java object (for passing to external functions) |
static Object |
convertToJava(Item item)
Convert an XPath value to a Java object. |
boolean |
effectiveBooleanValue()
Get the effective boolean value of the expression. |
boolean |
equals(Object obj)
Compare two (sequence) values for equality. |
static Value |
fromItem(Item item)
Static method to get a Value from an Item |
CharSequence |
getCanonicalLexicalRepresentation()
Get the canonical lexical representation as defined in XML Schema. |
int |
getCardinality()
Determine the cardinality |
ItemType |
getItemType(TypeHierarchy th)
Determine the data type of the items in the expression, if possible |
static SequenceIterator |
getIterator(ValueRepresentation val)
Get a SequenceIterator over a ValueRepresentation |
int |
getLength()
Get the length of the sequence |
Comparable |
getSchemaComparable()
Get a Comparable value that implements the XML Schema ordering comparison semantics for this value. |
String |
getStringValue()
Convert the value to a string, using the serialization rules. |
CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence. |
Item |
itemAt(int n)
Get the n'th item in the sequence (starting from 0). |
abstract SequenceIterator |
iterate()
Iterate over the items contained in this value. |
SequenceIterator |
iterate(XPathContext context)
Return an iterator over the results of evaluating an expression |
static QNameValue |
makeQNameValue(Object object,
Configuration config)
Temporary method to make a QNameValue from a JAXP 1.3 QName, without creating a compile-time link to the JDK 1.5 QName class |
void |
process(XPathContext context)
Process the value as an instruction, without returning any tail calls |
Value |
reduce()
Reduce a value to its simplest form. |
static double |
stringToNumber(CharSequence s)
Static method to convert strings to doubles. |
String |
toString()
Convert to a string for diagnostic output |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int INDETERMINATE_ORDERING
public static final Class[] EMPTY_CLASS_ARRAY
Constructor Detail |
---|
public Value()
Method Detail |
---|
public static Value asValue(ValueRepresentation val)
val
- The supplied value, or null, indicating the empty sequence.
public static Item asItem(ValueRepresentation value) throws XPathException
value
- the value to be converted
XPathException
- if the Value contains multiple itemspublic Item asItem() throws XPathException
XPathException
public static Value fromItem(Item item)
item
- the supplied item
public static SequenceIterator asIterator(ValueRepresentation val) throws XPathException
val
- The supplied value, or null, indicating the empty sequence.
XPathException
public static double stringToNumber(CharSequence s) throws NumberFormatException
s
- the String to be converted
NumberFormatException
- if the value cannot be convertedpublic static SequenceIterator getIterator(ValueRepresentation val) throws XPathException
val
- the value to iterate over
XPathException
public abstract SequenceIterator iterate() throws XPathException
XPathException
- if a dynamic error occurs. This is possible only in the case of values
that are materialized lazily, that is, where the iterate() method leads to computation of an
expression that delivers the values.public final SequenceIterator iterate(XPathContext context) throws XPathException
iterate
in interface SequenceIterable
context
- the dynamic evaluation context (not used in this implementation)
XPathException
public CharSequence getStringValueCS() throws XPathException
getStringValueCS
in interface ValueRepresentation
XPathException
- The method can fail if evaluation of the value
has been deferred, and if a failure occurs during the deferred evaluation.
No failure is possible in the case of an AtomicValue or a Node.public CharSequence getCanonicalLexicalRepresentation()
public ItemType getItemType(TypeHierarchy th)
th
- The TypeHierarchy. Can be null if the target is an AtomicValue.
public int getCardinality()
public Item itemAt(int n) throws XPathException
n
- position of the required item, counting from zero.
XPathException
public int getLength() throws XPathException
XPathException
public void process(XPathContext context) throws XPathException
context
- The dynamic context, giving access to the current node,
the current variables, etc.
XPathException
public String getStringValue() throws XPathException
getStringValue
in interface ValueRepresentation
XPathException
- The method can fail if evaluation of the value
has been deferred, and if a failure occurs during the deferred evaluation.
No failure is possible in the case of an AtomicValue.public boolean effectiveBooleanValue() throws XPathException
XPathException
- if any dynamic error occurs evaluating the
expressionpublic Comparable getSchemaComparable()
In the case of data types that are partially ordered, the returned Comparable extends the standard
semantics of the compareTo() method by returning the value INDETERMINATE_ORDERING
when there
is no defined order relationship between two given values.
public boolean equals(Object obj)
equals
in class Object
public void checkPermittedContents(SchemaType parentType, StaticContext env, boolean whole) throws XPathException
parentType
- The schema typeenv
- the static contextwhole
- true if this value accounts for the entire content of the containing node
XPathException
- if the expression doesn't match the required content typepublic Value reduce() throws XPathException
XPathException
public Object convertToJava(Class target, XPathContext context) throws XPathException
target
- the required target classcontext
- the XPath dynamic evaluation context
XPathException
public static Value convertJavaObjectToXPath(Object object, SequenceType requiredType, XPathContext context) throws XPathException
object
- The Java object to be convertedrequiredType
- The required type of the result (if known)context
- The XPath dynamic context
XPathException
public static QNameValue makeQNameValue(Object object, Configuration config)
object
- an instance of javax.xml.namespace.QNameconfig
- the Saxon configuration (used for dynamic loading)
public String toString()
toString
in class Object
public static Object convertToJava(Item item) throws XPathException
item
- the item to be converted
XPathException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |