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 |
|---|---|
String |
parseAnySimpleType(String
Return a string containing the lexical representation of the simple type.
|
byte[] |
parseBase64Binary(String
Converts the string argument into an array of bytes.
|
boolean |
parseBoolean(String
Converts the string argument into a boolean value.
|
byte |
parseByte(String
Converts the string argument into a byte value.
|
Calendar |
parseDate(String
Converts the string argument into a Calendar value.
|
Calendar |
parseDateTime(String
Converts the string argument into a Calendar value.
|
BigDecimal |
parseDecimal(String
Converts the string argument into a BigDecimal value.
|
double |
parseDouble(String
Converts the string argument into a double value.
|
float |
parseFloat(String
Converts the string argument into a float value.
|
byte[] |
parseHexBinary(String
Converts the string argument into an array of bytes.
|
int |
parseInt(String
Convert the string argument into an int value.
|
BigInteger |
parseInteger(String
Convert the string argument into a BigInteger value.
|
long |
parseLong(String
Converts the string argument into a long value.
|
QName |
parseQName(String
Converts the string argument into a QName value.
|
short |
parseShort(String
Converts the string argument into a short value.
|
String |
parseString(String
Convert the string argument into a string.
|
Calendar |
parseTime(String
Converts the string argument into a Calendar value.
|
long |
parseUnsignedInt(String
Converts the string argument into a long value.
|
int |
parseUnsignedShort(String
Converts the string argument into an int value.
|
String |
printAnySimpleType(String
Converts a string value into a string.
|
String |
printBase64Binary(byte[] val)
Converts an array of bytes into a string.
|
String |
printBoolean(boolean val)
Converts a boolean value into a string.
|
String |
printByte(byte val)
Converts a byte value into a string.
|
String |
printDate(Calendar
Converts a Calendar value into a string.
|
String |
printDateTime(Calendar
Converts a Calendar value into a string.
|
String |
printDecimal(BigDecimal
Converts a BigDecimal value into a string.
|
String |
printDouble(double val)
Converts a double value into a string.
|
String |
printFloat(float val)
Converts a float value into a string.
|
String |
printHexBinary(byte[] val)
Converts an array of bytes into a string.
|
String |
printInt(int val)
Converts an int value into a string.
|
String |
printInteger(BigInteger
Converts a BigInteger value into a string.
|
String |
printLong(long val)
Converts a long value into a string.
|
String |
printQName(QName
Converts a QName instance into a string.
|
String |
printShort(short val)
Converts a short value into a string.
|
String |
printString(String
Converts the string argument into a string.
|
String |
printTime(Calendar
Converts a Calendar value into a string.
|
String |
printUnsignedInt(long val)
Converts a long value into a string.
|
String |
printUnsignedShort(int val)
Converts an int value into a string.
|
StringparseString(String lexicalXSDString)
Convert the string argument into a string.
lexicalXSDString - A lexical representation of the XML Schema datatype xsd:string
BigIntegerparseInteger(String lexicalXSDInteger)
Convert the string argument into a BigInteger value.
lexicalXSDInteger - A string containing a lexical representation of xsd:integer.
NumberFormatException -
lexicalXSDInteger is not a valid string representation of a
BigInteger value.
int parseInt(StringlexicalXSDInt)
Convert the string argument into an int value.
lexicalXSDInt - A string containing a lexical representation of xsd:int.
NumberFormatException -
lexicalXSDInt is not a valid string representation of an
int value.
long parseLong(StringlexicalXSDLong)
Converts the string argument into a long value.
lexicalXSDLong - A string containing lexical representation of xsd:long.
NumberFormatException -
lexicalXSDLong is not a valid string representation of a
long value.
short parseShort(StringlexicalXSDShort)
Converts the string argument into a short value.
lexicalXSDShort - A string containing lexical representation of xsd:short.
NumberFormatException -
lexicalXSDShort is not a valid string representation of a
short value.
BigDecimalparseDecimal(String lexicalXSDDecimal)
Converts the string argument into a BigDecimal value.
lexicalXSDDecimal - A string containing lexical representation of xsd:decimal.
NumberFormatException -
lexicalXSDDecimal is not a valid string representation of
BigDecimal.
float parseFloat(StringlexicalXSDFloat)
Converts the string argument into a float value.
lexicalXSDFloat - A string containing lexical representation of xsd:float.
NumberFormatException -
lexicalXSDFloat is not a valid string representation of a
float value.
double parseDouble(StringlexicalXSDDouble)
Converts the string argument into a double value.
lexicalXSDDouble - A string containing lexical representation of xsd:double.
NumberFormatException -
lexicalXSDDouble is not a valid string representation of a
double value.
boolean parseBoolean(StringlexicalXSDBoolean)
Converts the string argument into a boolean value.
lexicalXSDBoolean - A string containing lexical representation of xsd:boolean.
IllegalArgumentException - if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:boolean.
byte parseByte(StringlexicalXSDByte)
Converts the string argument into a byte value.
lexicalXSDByte - A string containing lexical representation of xsd:byte.
NumberFormatException -
lexicalXSDByte does not contain a parseable byte.
IllegalArgumentException - if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:byte.
QNameparseQName(String lexicalXSDQName, NamespaceContext nsc)
Converts the string argument into a QName value.
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.
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.
CalendarparseDateTime(String lexicalXSDDateTime)
Converts the string argument into a Calendar value.
lexicalXSDDateTime - A string containing lexical representation of xsd:datetime.
IllegalArgumentException - if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:dateTime.
byte[] parseBase64Binary(StringlexicalXSDBase64Binary)
Converts the string argument into an array of bytes.
lexicalXSDBase64Binary - A string containing lexical representation of xsd:base64Binary.
IllegalArgumentException - if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:base64Binary
byte[] parseHexBinary(StringlexicalXSDHexBinary)
Converts the string argument into an array of bytes.
lexicalXSDHexBinary - A string containing lexical representation of xsd:hexBinary.
IllegalArgumentException - if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:hexBinary.
long parseUnsignedInt(StringlexicalXSDUnsignedInt)
Converts the string argument into a long value.
lexicalXSDUnsignedInt - A string containing lexical representation of xsd:unsignedInt.
NumberFormatException - if string parameter can not be parsed into a
long value.
int parseUnsignedShort(StringlexicalXSDUnsignedShort)
Converts the string argument into an int value.
lexicalXSDUnsignedShort - A string containing lexical representation of xsd:unsignedShort.
NumberFormatException - if string parameter can not be parsed into an
int value.
CalendarparseTime(String lexicalXSDTime)
Converts the string argument into a Calendar value.
lexicalXSDTime - A string containing lexical representation of xsd:Time.
IllegalArgumentException - if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Time.
CalendarparseDate(String lexicalXSDDate)
Converts the string argument into a Calendar value.
lexicalXSDDate - A string containing lexical representation of xsd:Date.
IllegalArgumentException - if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Date.
StringparseAnySimpleType(String lexicalXSDAnySimpleType)
Return a string containing the lexical representation of the simple type.
lexicalXSDAnySimpleType - A string containing lexical representation of the simple type.
StringprintString(String val)
Converts the string argument into a string.
val - A string value.
StringprintInteger(BigInteger val)
Converts a BigInteger value into a string.
val - A BigInteger value
IllegalArgumentException -
val is null.
StringprintInt(int val)
Converts an int value into a string.
val - An int value
StringprintLong(long val)
Converts a long value into a string.
val - A long value
StringprintShort(short val)
Converts a short value into a string.
val - A short value
StringprintDecimal(BigDecimal val)
Converts a BigDecimal value into a string.
val - A BigDecimal value
IllegalArgumentException -
val is null.
StringprintFloat(float val)
Converts a float value into a string.
val - A float value
StringprintDouble(double val)
Converts a double value into a string.
val - A double value
StringprintBoolean(boolean val)
Converts a boolean value into a string.
val - A boolean value
StringprintByte(byte val)
Converts a byte value into a string.
val - A byte value
StringprintQName(QName val, NamespaceContext nsc)
Converts a QName instance into a string.
val - A QName value
nsc - A namespace context for interpreting a prefix within a QName.
IllegalArgumentException - if
val is null or if
nsc is non-null or
nsc.getPrefix(nsprefixFromVal) is null.
StringprintDateTime(Calendar val)
Converts a Calendar value into a string.
val - A Calendar value
IllegalArgumentException - if
val is null.
StringprintBase64Binary(byte[] val)
Converts an array of bytes into a string.
val - an array of bytes
IllegalArgumentException - if
val is null.
StringprintHexBinary(byte[] val)
Converts an array of bytes into a string.
val - an array of bytes
IllegalArgumentException - if
val is null.
StringprintUnsignedInt(long val)
Converts a long value into a string.
val - A long value
StringprintUnsignedShort(int val)
Converts an int value into a string.
val - An int value
StringprintTime(Calendar val)
Converts a Calendar value into a string.
val - A Calendar value
IllegalArgumentException - if
val is null.
StringprintDate(Calendar val)
Converts a Calendar value into a string.
val - A Calendar value
IllegalArgumentException - if
val is null.