public interface DatatypeConverterInterface
The DatatypeConverterInterface is for JAXB provider use only. A
JAXB provider must supply a class that implements this interface.
JAXB Providers are required to call the
DatatypeConverter.setDatatypeConverter
api at
some point before the first marshal or unmarshal operation (perhaps during
the call to JAXBContext.newInstance). This step is necessary to configure
the converter that should be used to perform the print and parse
functionality. Calling this api repeatedly will have no effect - the
DatatypeConverter instance passed into the first invocation is the one that
will be used from then on.
This interface defines the parse and print methods. There is one parse and print method for each XML schema datatype specified in the the default binding Table 5-1 in the JAXB specification.
The parse and print methods defined here are invoked by the static parse
and print methods defined in the DatatypeConverter
class.
A parse method for a XML schema datatype must be capable of converting any lexical representation of the XML schema datatype ( specified by the XML Schema Part2: Datatypes specification into a value in the value space of the XML schema datatype. If an error is encountered during conversion, then an IllegalArgumentException or a subclass of IllegalArgumentException must be thrown by the method.
A print method for a XML schema datatype can output any lexical representation that is valid with respect to the XML schema datatype. If an error is encountered during conversion, then an IllegalArgumentException, or a subclass of IllegalArgumentException must be thrown by the method.
The prefix xsd: is used to refer to XML schema datatypes XML Schema Part2: Datatypes specification.
DatatypeConverter
,
ParseConversionEvent
,
PrintConversionEvent
Modifier and Type | Method and Description |
---|---|
java.lang.String |
parseAnySimpleType(java.lang.String lexicalXSDAnySimpleType)
Return a string containing the lexical representation of the
simple type.
|
byte[] |
parseBase64Binary(java.lang.String lexicalXSDBase64Binary)
Converts the string argument into an array of bytes.
|
boolean |
parseBoolean(java.lang.String lexicalXSDBoolean)
Converts the string argument into a boolean value.
|
byte |
parseByte(java.lang.String lexicalXSDByte)
Converts the string argument into a byte value.
|
java.util.Calendar |
parseDate(java.lang.String lexicalXSDDate)
Converts the string argument into a Calendar value.
|
java.util.Calendar |
parseDateTime(java.lang.String lexicalXSDDateTime)
Converts the string argument into a Calendar value.
|
java.math.BigDecimal |
parseDecimal(java.lang.String lexicalXSDDecimal)
Converts the string argument into a BigDecimal value.
|
double |
parseDouble(java.lang.String lexicalXSDDouble)
Converts the string argument into a double value.
|
float |
parseFloat(java.lang.String lexicalXSDFloat)
Converts the string argument into a float value.
|
byte[] |
parseHexBinary(java.lang.String lexicalXSDHexBinary)
Converts the string argument into an array of bytes.
|
int |
parseInt(java.lang.String lexicalXSDInt)
Convert the string argument into an int value.
|
java.math.BigInteger |
parseInteger(java.lang.String lexicalXSDInteger)
Convert the string argument into a BigInteger value.
|
long |
parseLong(java.lang.String lexicalXSDLong)
Converts the string argument into a long value.
|
javax.xml.namespace.QName |
parseQName(java.lang.String lexicalXSDQName,
javax.xml.namespace.NamespaceContext nsc)
Converts the string argument into a QName value.
|
short |
parseShort(java.lang.String lexicalXSDShort)
Converts the string argument into a short value.
|
java.lang.String |
parseString(java.lang.String lexicalXSDString)
Convert the string argument into a string.
|
java.util.Calendar |
parseTime(java.lang.String lexicalXSDTime)
Converts the string argument into a Calendar value.
|
long |
parseUnsignedInt(java.lang.String lexicalXSDUnsignedInt)
Converts the string argument into a long value.
|
int |
parseUnsignedShort(java.lang.String lexicalXSDUnsignedShort)
Converts the string argument into an int value.
|
java.lang.String |
printAnySimpleType(java.lang.String val)
Converts a string value into a string.
|
java.lang.String |
printBase64Binary(byte[] val)
Converts an array of bytes into a string.
|
java.lang.String |
printBoolean(boolean val)
Converts a boolean value into a string.
|
java.lang.String |
printByte(byte val)
Converts a byte value into a string.
|
java.lang.String |
printDate(java.util.Calendar val)
Converts a Calendar value into a string.
|
java.lang.String |
printDateTime(java.util.Calendar val)
Converts a Calendar value into a string.
|
java.lang.String |
printDecimal(java.math.BigDecimal val)
Converts a BigDecimal value into a string.
|
java.lang.String |
printDouble(double val)
Converts a double value into a string.
|
java.lang.String |
printFloat(float val)
Converts a float value into a string.
|
java.lang.String |
printHexBinary(byte[] val)
Converts an array of bytes into a string.
|
java.lang.String |
printInt(int val)
Converts an int value into a string.
|
java.lang.String |
printInteger(java.math.BigInteger val)
Converts a BigInteger value into a string.
|
java.lang.String |
printLong(long val)
Converts a long value into a string.
|
java.lang.String |
printQName(javax.xml.namespace.QName val,
javax.xml.namespace.NamespaceContext nsc)
Converts a QName instance into a string.
|
java.lang.String |
printShort(short val)
Converts a short value into a string.
|
java.lang.String |
printString(java.lang.String val)
Converts the string argument into a string.
|
java.lang.String |
printTime(java.util.Calendar val)
Converts a Calendar value into a string.
|
java.lang.String |
printUnsignedInt(long val)
Converts a long value into a string.
|
java.lang.String |
printUnsignedShort(int val)
Converts an int value into a string.
|
java.lang.String parseString(java.lang.String lexicalXSDString)
lexicalXSDString
- A lexical representation of the XML Schema datatype xsd:stringjava.math.BigInteger parseInteger(java.lang.String lexicalXSDInteger)
lexicalXSDInteger
- A string containing a lexical representation of
xsd:integer.java.lang.NumberFormatException
- lexicalXSDInteger
is not a valid string representation of a BigInteger
value.int parseInt(java.lang.String lexicalXSDInt)
lexicalXSDInt
- A string containing a lexical representation of
xsd:int.java.lang.NumberFormatException
- lexicalXSDInt
is not a valid string representation of an int
value.long parseLong(java.lang.String lexicalXSDLong)
lexicalXSDLong
- A string containing lexical representation of
xsd:long.java.lang.NumberFormatException
- lexicalXSDLong
is not a valid string representation of a long
value.short parseShort(java.lang.String lexicalXSDShort)
lexicalXSDShort
- A string containing lexical representation of
xsd:short.java.lang.NumberFormatException
- lexicalXSDShort
is not a valid string representation of a short
value.java.math.BigDecimal parseDecimal(java.lang.String lexicalXSDDecimal)
lexicalXSDDecimal
- A string containing lexical representation of
xsd:decimal.java.lang.NumberFormatException
- lexicalXSDDecimal
is not a valid string representation of BigDecimal
.float parseFloat(java.lang.String lexicalXSDFloat)
lexicalXSDFloat
- A string containing lexical representation of
xsd:float.java.lang.NumberFormatException
- lexicalXSDFloat
is not a valid string representation of a float
value.double parseDouble(java.lang.String lexicalXSDDouble)
lexicalXSDDouble
- A string containing lexical representation of
xsd:double.java.lang.NumberFormatException
- lexicalXSDDouble
is not a valid string representation of a double
value.boolean parseBoolean(java.lang.String lexicalXSDBoolean)
lexicalXSDBoolean
- A string containing lexical representation of
xsd:boolean.java.lang.IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:boolean.byte parseByte(java.lang.String lexicalXSDByte)
lexicalXSDByte
- A string containing lexical representation of
xsd:byte.java.lang.NumberFormatException
- lexicalXSDByte
does not contain a parseable byte.java.lang.IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:byte.javax.xml.namespace.QName parseQName(java.lang.String lexicalXSDQName, javax.xml.namespace.NamespaceContext nsc)
String parameter lexicalXSDQname
must conform to lexical value space specifed at
XML Schema Part 2:Datatypes specification:QNames
lexicalXSDQName
- A string containing lexical representation of xsd:QName.nsc
- A namespace context for interpreting a prefix within a QName.java.lang.IllegalArgumentException
- if string parameter does not conform to XML Schema Part 2 specification or
if namespace prefix of lexicalXSDQname
is not bound to a URI in NamespaceContext nsc
.java.util.Calendar parseDateTime(java.lang.String lexicalXSDDateTime)
lexicalXSDDateTime
- A string containing lexical representation of
xsd:datetime.java.lang.IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:dateTime.byte[] parseBase64Binary(java.lang.String lexicalXSDBase64Binary)
lexicalXSDBase64Binary
- A string containing lexical representation
of xsd:base64Binary.java.lang.IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:base64Binarybyte[] parseHexBinary(java.lang.String lexicalXSDHexBinary)
lexicalXSDHexBinary
- A string containing lexical representation of
xsd:hexBinary.java.lang.IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:hexBinary.long parseUnsignedInt(java.lang.String lexicalXSDUnsignedInt)
lexicalXSDUnsignedInt
- A string containing lexical representation
of xsd:unsignedInt.java.lang.NumberFormatException
- if string parameter can not be parsed into a long
value.int parseUnsignedShort(java.lang.String lexicalXSDUnsignedShort)
lexicalXSDUnsignedShort
- A string containing lexical
representation of xsd:unsignedShort.java.lang.NumberFormatException
- if string parameter can not be parsed into an int
value.java.util.Calendar parseTime(java.lang.String lexicalXSDTime)
lexicalXSDTime
- A string containing lexical representation of
xsd:Time.java.lang.IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Time.java.util.Calendar parseDate(java.lang.String lexicalXSDDate)
lexicalXSDDate
- A string containing lexical representation of
xsd:Date.java.lang.IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Date.java.lang.String parseAnySimpleType(java.lang.String lexicalXSDAnySimpleType)
lexicalXSDAnySimpleType
- A string containing lexical
representation of the simple type.java.lang.String printString(java.lang.String val)
val
- A string value.java.lang.String printInteger(java.math.BigInteger val)
val
- A BigInteger valuejava.lang.IllegalArgumentException
- val
is null.java.lang.String printInt(int val)
val
- An int valuejava.lang.String printLong(long val)
val
- A long valuejava.lang.String printShort(short val)
val
- A short valuejava.lang.String printDecimal(java.math.BigDecimal val)
val
- A BigDecimal valuejava.lang.IllegalArgumentException
- val
is null.java.lang.String printFloat(float val)
val
- A float valuejava.lang.String printDouble(double val)
val
- A double valuejava.lang.String printBoolean(boolean val)
val
- A boolean valuejava.lang.String printByte(byte val)
val
- A byte valuejava.lang.String printQName(javax.xml.namespace.QName val, javax.xml.namespace.NamespaceContext nsc)
val
- A QName valuensc
- A namespace context for interpreting a prefix within a QName.java.lang.IllegalArgumentException
- if val
is null or
if nsc
is non-null or nsc.getPrefix(nsprefixFromVal)
is null.java.lang.String printDateTime(java.util.Calendar val)
val
- A Calendar valuejava.lang.IllegalArgumentException
- if val
is null.java.lang.String printBase64Binary(byte[] val)
val
- an array of bytesjava.lang.IllegalArgumentException
- if val
is null.java.lang.String printHexBinary(byte[] val)
val
- an array of bytesjava.lang.IllegalArgumentException
- if val
is null.java.lang.String printUnsignedInt(long val)
val
- A long valuejava.lang.String printUnsignedShort(int val)
val
- An int valuejava.lang.String printTime(java.util.Calendar val)
val
- A Calendar valuejava.lang.IllegalArgumentException
- if val
is null.java.lang.String printDate(java.util.Calendar val)
val
- A Calendar valuejava.lang.IllegalArgumentException
- if val
is null.java.lang.String printAnySimpleType(java.lang.String val)
val
- A string value