public class XdmAtomicValue extends XdmItem
An XdmAtomicValue
is immutable.
Modifier | Constructor and Description |
---|---|
protected |
XdmAtomicValue(AtomicValue value) |
|
XdmAtomicValue(BigDecimal value)
Create an xs:decimal atomic value
|
|
XdmAtomicValue(boolean value)
Create an xs:boolean atomic value
|
|
XdmAtomicValue(double value)
Create an xs:double atomic value
|
|
XdmAtomicValue(float value)
Create an xs:float atomic value
|
|
XdmAtomicValue(long value)
Create an xs:integer atomic value
|
|
XdmAtomicValue(QName value)
Create an xs:QName atomic value
|
|
XdmAtomicValue(String value)
Create an xs:string atomic value
|
|
XdmAtomicValue(String lexicalForm,
ItemType type)
Construct an atomic value given its lexical representation and the name of the required
built-in atomic type.
|
|
XdmAtomicValue(URI value)
Create an xs:anyURI atomic value
|
Modifier and Type | Method and Description |
---|---|
boolean |
getBooleanValue()
Get the value converted to a boolean using the XPath casting rules
|
BigDecimal |
getDecimalValue()
Get the value converted to a decimal using the XPath casting rules
|
double |
getDoubleValue()
Get the value converted to a double using the XPath casting rules.
|
long |
getLongValue()
Get the value converted to an integer using the XPath casting rules
|
QName |
getPrimitiveTypeName()
Get the primitive type of this atomic value, as a QName.
|
Object |
getValue()
Get the value as a Java object of the nearest equivalent type.
|
String |
toString()
Get the result of converting the atomic value to a string.
|
asMap, getStringValue, isAtomicValue, newAtomicValue, size, wrapItem
protected XdmAtomicValue(AtomicValue value)
public XdmAtomicValue(boolean value)
value
- the boolean value, true or falsepublic XdmAtomicValue(long value)
value
- the xs:integer value, as a longpublic XdmAtomicValue(BigDecimal value)
value
- the xs:decimal value, as a BigDecimalpublic XdmAtomicValue(double value)
value
- the xs:double value, as a doublepublic XdmAtomicValue(float value)
value
- the xs:float value, as a floatpublic XdmAtomicValue(String value)
value
- the xs:string value, as a stringpublic XdmAtomicValue(URI value)
value
- the xs:anyURI value, as a URIpublic XdmAtomicValue(QName value)
value
- the xs:QName value, as a QNamepublic XdmAtomicValue(String lexicalForm, ItemType type) throws SaxonApiException
This method cannot be used to construct values that are namespace-sensitive (QNames and Notations)
lexicalForm
- the value in the lexical space of the target data type. More strictly, the input
value before the actions of the whitespace facet for the target data type are applied.type
- the required atomic type. This must either be one of the built-in
atomic types defined in XML Schema, or a user-defined type whose definition appears
in a schema that is known to the Processor. It must not be an abstract type.SaxonApiException
- if the type is unknown, or is not atomic, or is namespace-sensitive;
or if the value supplied in lexicalForm is not in the lexical space of the specified atomic
type.public String toString()
public QName getPrimitiveTypeName()
public Object getValue()
The result type is as follows:
XPath type | Java class |
---|---|
xs:string | String |
xs:integer | java.math.BigInteger |
xs:decimal | java.math.BigDecimal |
xs:double | Double |
xs:float | Float |
xs:boolean | Boolean |
xs:QName | QName |
xs:anyURI | String |
xs:untypedAtomic | String |
Other types | currently String, but this may change in the future |
public boolean getBooleanValue() throws SaxonApiException
SaxonApiException
- if the value cannot be cast to a booleanpublic long getLongValue() throws SaxonApiException
SaxonApiException
- if the value cannot be cast to an integerpublic double getDoubleValue() throws SaxonApiException
If the value is a string, the XSD 1.1 rules are used, which means that the string "+INF" is recognised.
SaxonApiException
- if the value cannot be cast to a doublepublic BigDecimal getDecimalValue() throws SaxonApiException
SaxonApiException
- if the value cannot be cast to a doubleCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.