Package com.icl.saxon.expr
Class NumericValue
- java.lang.Object
-
- com.icl.saxon.expr.Expression
-
- com.icl.saxon.expr.Value
-
- com.icl.saxon.expr.NumericValue
-
public final class NumericValue extends Value
A numeric (floating point) value
-
-
Field Summary
-
Fields inherited from class com.icl.saxon.expr.Expression
staticContext
-
-
Constructor Summary
Constructors Constructor Description NumericValue(double value)
Constructor supplying a doubleNumericValue(String s)
Constructor supplying a String
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
asBoolean()
Convert the value to a booleandouble
asNumber()
Get the value as a numberString
asString()
Get the value as a StringString
asStringOLD()
Get the value as a Stringint
conversionPreference(Class required)
Get conversion preference for this value to a Java class.Object
convertToJava(Class target)
Convert to Java object (for passing to external functions)void
display(int level)
Diagnostic print of expression structureint
getDataType()
Determine the data type of the exprssion, if possible-
Methods inherited from class com.icl.saxon.expr.Value
compare, equals, evaluate, getDependencies, inverse, notEquals, numericCompare, reduce, simplify, stringToNumber
-
Methods inherited from class com.icl.saxon.expr.Expression
containsReferences, enumerate, evaluateAsBoolean, evaluateAsNodeSet, evaluateAsNumber, evaluateAsString, getStaticContext, indent, isContextDocumentNodeSet, make, outputStringValue, setStaticContext, usesCurrent
-
-
-
-
Constructor Detail
-
NumericValue
public NumericValue(double value)
Constructor supplying a double
-
NumericValue
public NumericValue(String s)
Constructor supplying a String
-
-
Method Detail
-
asStringOLD
public String asStringOLD()
Get the value as a String- Returns:
- a String representation of the value
-
asString
public String asString()
Get the value as a String
-
asNumber
public double asNumber()
Get the value as a number
-
asBoolean
public boolean asBoolean()
Convert the value to a boolean
-
getDataType
public int getDataType()
Determine the data type of the exprssion, if possible- Specified by:
getDataType
in classExpression
- Returns:
- one of the values Value.STRING, Value.BOOLEAN, Value.NUMBER, Value.NODESET, Value.FRAGMENT, or Value.ANY (meaning not known in advance)
-
conversionPreference
public int conversionPreference(Class required)
Get conversion preference for this value to a Java class. A low result indicates higher preference.- Specified by:
conversionPreference
in classValue
-
convertToJava
public Object convertToJava(Class target) throws XPathException
Convert to Java object (for passing to external functions)- Specified by:
convertToJava
in classValue
- Parameters:
target
- The class required by the external function- Returns:
- an object of the target class
- Throws:
XPathException
-
display
public void display(int level)
Diagnostic print of expression structure- Specified by:
display
in classExpression
-
-