|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.xml.bind.DatatypeConverter
This is a helper class for customized datatypes. It provides a set of static methods which may be useful in custom methods for parsing and printing values.
The JAXB provider is responsible to initialize the
DatatypeConverter class by invoking
setDatatypeConverter(DatatypeConverterInterface) as soon
as possible.
| Constructor Summary | |
DatatypeConverter()
|
|
| Method Summary | |
static java.lang.String |
parseAnySimpleType(java.lang.String pLexicalXSDAnySimpleType)
Returns the lexical representation of the input string, which is the unmodified input string. |
static byte[] |
parseBase64Binary(java.lang.String pLexicalXSDBase64Binary)
Parses the lexical representation of the given byte array, which is encoded in base 64. |
static boolean |
parseBoolean(java.lang.String pLexicalXSDBoolean)
Parses the lexical representation of the given boolean value and converts it into a primitive boolean value. |
static byte |
parseByte(java.lang.String pLexicalXSDByte)
Parses the lexical representation of the given 8 bit integer value and converts it into a primitive byte value. |
static java.util.Calendar |
parseDate(java.lang.String pLexicalXSDDate)
Parses the lexical representation of the given date value and converts it into an instance of Calendar.
|
static java.util.Calendar |
parseDateTime(java.lang.String pLexicalXSDDateTime)
Parses the lexical representation of the given dateTime value and converts it into an instance of Calendar.
|
static java.math.BigDecimal |
parseDecimal(java.lang.String pLexicalXSDDecimal)
Parses the lexical representation of the given decimal value (arbitrary precision) and converts it into an instance of BigDecimal. |
static double |
parseDouble(java.lang.String pLexicalXSDDouble)
Parses the lexical representation of the given 64 bit floating point value and converts it into a primitive double value. |
static float |
parseFloat(java.lang.String pLexicalXSDFloat)
Parses the lexical representation of the given 32 bit floating point value and converts it into a primitive float value. |
static byte[] |
parseHexBinary(java.lang.String pLexicalXSDHexBinary)
Parses the lexical representation of the given byte array, which is encoded in hex digits. |
static int |
parseInt(java.lang.String pLexicalXSDInt)
Parses the lexical representation of the given 32 bit integer value and converts it into a primitive int value. |
static java.math.BigInteger |
parseInteger(java.lang.String pLexicalXSDInteger)
Parses the lexical representation of the given integer value (arbitrary precision) and converts it into an instance of BigInteger. |
static long |
parseLong(java.lang.String pLexicalXSDLong)
Parses the lexical representation of the given 64 bit integer value and converts it into a primitive long value. |
static QName |
parseQName(java.lang.String pLexicalXSDQName,
NamespaceContext pNamespaceContext)
Parses the lexical representation of the given qualified name and converts it into an instance of QName.
|
static short |
parseShort(java.lang.String pLexicalXSDShort)
Parses the lexical representation of the given 16 bit integer value and converts it into a primitive short value. |
static java.lang.String |
parseString(java.lang.String pLexicalXSDString)
Parses the lexical representation and converts it into a String. |
static java.util.Calendar |
parseTime(java.lang.String pLexicalXSDTime)
Parses the lexical representation of the given time value and converts it into an instance of Calendar.
|
static long |
parseUnsignedInt(java.lang.String pLexicalXSDUnsignedInt)
Parses the lexical representation of the given 32 bit unsignet integer value and converts it into a primitive long
value. |
static int |
parseUnsignedShort(java.lang.String pLexicalXSDUnsignedShort)
Parses the lexical representation of the given 16 bit unsignet integer value and converts it into a primitive int
value. |
static java.lang.String |
printAnySimpleType(java.lang.String pValue)
Returns a lexical representation of the given input string, which is the unmodified input string. |
static java.lang.String |
printBase64Binary(byte[] pValue)
Returns a lexical representation of the given byte array. |
static java.lang.String |
printBoolean(boolean pValue)
Returns a lexical representation of the given primitive boolean value. |
static java.lang.String |
printByte(byte pValue)
Returns a lexical representation of the given primitive 8 bit integer. |
static java.lang.String |
printDate(java.util.Calendar pValue)
Returns a lexical representation of the given date value. |
static java.lang.String |
printDateTime(java.util.Calendar pValue)
Returns a lexical representation of the given dateTime value. |
static java.lang.String |
printDecimal(java.math.BigDecimal pValue)
Returns a lexical representation of the given instance of BigDecimal, which is a decimal number in arbitrary
precision. |
static java.lang.String |
printDouble(double pValue)
Returns a lexical representation of the given primitive 64 bit floating point number. |
static java.lang.String |
printFloat(float pValue)
Returns a lexical representation of the given primitive 32 bit floating point number. |
static java.lang.String |
printHexBinary(byte[] pValue)
Returns a lexical representation of the given byte array. |
static java.lang.String |
printInt(int pValue)
Returns a lexical representation of the given primitive 32 bit integer. |
static java.lang.String |
printInteger(java.math.BigInteger pValue)
Returns a lexical representation of the given instance of BigInteger, which is an integer in arbitrary precision. |
static java.lang.String |
printLong(long pValue)
Returns a lexical representation of the given primitive 64 bit integer. |
static java.lang.String |
printQName(QName pValue,
NamespaceContext pNamespaceContext)
Returns a lexical representation of the given qualified name, which is a combination of namespace URI and local name. |
static java.lang.String |
printShort(short pValue)
Returns a lexical representation of the given primitive 16 bit integer. |
static java.lang.String |
printString(java.lang.String pValue)
Returns a lexical representation of the given input string, which is the unmodified input string. |
static java.lang.String |
printTime(java.util.Calendar pValue)
Returns a lexical representation of the given time value. |
static java.lang.String |
printUnsignedInt(long pValue)
Returns a lexical representation of the given primitive, unsigned 32 bit integer. |
static java.lang.String |
printUnsignedShort(int pValue)
Returns a lexical representation of the given primitive, unsigned 16 bit integer. |
static void |
setDatatypeConverter(DatatypeConverterInterface pConverter)
This method must be invoked by the JAXB provider to set the actual instance, which is invoked by the static methods. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DatatypeConverter()
| Method Detail |
public static void setDatatypeConverter(DatatypeConverterInterface pConverter)
This method must be invoked by the JAXB provider to set the actual instance, which is invoked by the static methods. Subsequent invocations of the method are ignored: First come, first wins.
java.lang.IllegalArgumentException - The parameter was null.public static java.lang.String parseString(java.lang.String pLexicalXSDString)
Parses the lexical representation and converts it into a String.
pLexicalXSDString - The input string being parsed.
ParseConversionEventpublic static java.math.BigInteger parseInteger(java.lang.String pLexicalXSDInteger)
Parses the lexical representation of the given integer value
(arbitrary precision) and converts it into an instance of
BigInteger.
pLexicalXSDInteger - The input string being parsed.
BigInteger.ParseConversionEventpublic static int parseInt(java.lang.String pLexicalXSDInt)
Parses the lexical representation of the given 32 bit integer value
and converts it into a primitive int value.
pLexicalXSDInt - The input string being parsed.
int.ParseConversionEventpublic static long parseLong(java.lang.String pLexicalXSDLong)
Parses the lexical representation of the given 64 bit integer value
and converts it into a primitive long value.
pLexicalXSDLong - The input string being parsed.
long.ParseConversionEventpublic static short parseShort(java.lang.String pLexicalXSDShort)
Parses the lexical representation of the given 16 bit integer value
and converts it into a primitive short value.
pLexicalXSDShort - The input string being parsed.
short.ParseConversionEventpublic static java.math.BigDecimal parseDecimal(java.lang.String pLexicalXSDDecimal)
Parses the lexical representation of the given decimal value
(arbitrary precision) and converts it into an instance of
BigDecimal.
pLexicalXSDDecimal - The input string being parsed.
BigDecimal.ParseConversionEventpublic static float parseFloat(java.lang.String pLexicalXSDFloat)
Parses the lexical representation of the given 32 bit floating
point value and converts it into a primitive float value.
pLexicalXSDFloat - The input string being parsed.
float.ParseConversionEventpublic static double parseDouble(java.lang.String pLexicalXSDDouble)
Parses the lexical representation of the given 64 bit floating
point value and converts it into a primitive double value.
pLexicalXSDDouble - The input string being parsed.
double.ParseConversionEventpublic static boolean parseBoolean(java.lang.String pLexicalXSDBoolean)
Parses the lexical representation of the given boolean value
and converts it into a primitive boolean value.
pLexicalXSDBoolean - The input string being parsed.
boolean.ParseConversionEventpublic static byte parseByte(java.lang.String pLexicalXSDByte)
Parses the lexical representation of the given 8 bit integer value
and converts it into a primitive byte value.
pLexicalXSDByte - The input string being parsed.
byte.ParseConversionEvent
public static QName parseQName(java.lang.String pLexicalXSDQName,
NamespaceContext pNamespaceContext)
Parses the lexical representation of the given qualified name
and converts it into an instance of QName.
The QName consists of a namespace URI
and a local name.
pLexicalXSDQName - The input string being parsed, an optional
namespace prefix, followed by the local name, if any. If a prefix
is present, they are separated by a colon.pNamespaceContext - The namespace context is used to query
mappings between prefixes and namespace URI's.
QName.ParseConversionEventpublic static java.util.Calendar parseDateTime(java.lang.String pLexicalXSDDateTime)
Parses the lexical representation of the given dateTime value
and converts it into an instance of Calendar.
Valid lexical representations of a dateTime value include
YYYY-MM-DDThh:mm:ss YYYY-MM-DDThh:mm:ss.sss YYYY-MM-DDThh:mm:ssZ YYYY-MM-DDThh:mm:ss-01:00The former examples are all specified in UTC time. The last example uses a negatice offset of one hour to UTC.
pLexicalXSDDateTime - The input string being parsed.
Calendar.ParseConversionEventpublic static byte[] parseBase64Binary(java.lang.String pLexicalXSDBase64Binary)
Parses the lexical representation of the given byte array, which is encoded in base 64.
pLexicalXSDBase64Binary - The input string being parsed, a
base 64 encoded array of bytes.
ParseConversionEventpublic static byte[] parseHexBinary(java.lang.String pLexicalXSDHexBinary)
Parses the lexical representation of the given byte array, which is encoded in hex digits.
pLexicalXSDHexBinary - The input string being parsed, an
array of bytes encoded in hex digits.
ParseConversionEventpublic static long parseUnsignedInt(java.lang.String pLexicalXSDUnsignedInt)
Parses the lexical representation of the given 32 bit
unsignet integer value and converts it into a primitive long
value.
pLexicalXSDUnsignedInt - The input string being parsed.
long.ParseConversionEventpublic static int parseUnsignedShort(java.lang.String pLexicalXSDUnsignedShort)
Parses the lexical representation of the given 16 bit
unsignet integer value and converts it into a primitive int
value.
pLexicalXSDUnsignedShort - The input string being parsed.
int.ParseConversionEventpublic static java.util.Calendar parseTime(java.lang.String pLexicalXSDTime)
Parses the lexical representation of the given time value
and converts it into an instance of Calendar.
Valid lexical representations of a time value include
hh:mm:ss hh:mm:ss.sss hh:mm:ssZ hh:mm:ss-01:00The former examples are all specified in UTC time. The last example uses a negatice offset of one hour to UTC.
pLexicalXSDTime - The input string being parsed.
Calendar.ParseConversionEventpublic static java.util.Calendar parseDate(java.lang.String pLexicalXSDDate)
Parses the lexical representation of the given date value
and converts it into an instance of Calendar.
Valid lexical representations of a date value include
YYYY-MM-DD YYYY-MM-DDZ YYYY-MM-DD-01:00The former examples are all specified in UTC time. The last example uses a negatice offset of one hour to UTC.
pLexicalXSDDate - The input string being parsed.
Calendar.ParseConversionEventpublic static java.lang.String parseAnySimpleType(java.lang.String pLexicalXSDAnySimpleType)
Returns the lexical representation of the input string, which is the unmodified input string.
pLexicalXSDAnySimpleType - An input string in lexical representation.
ParseConversionEventpublic static java.lang.String printString(java.lang.String pValue)
Returns a lexical representation of the given input string, which is the unmodified input string.
pValue - The input string.
PrintConversionEventpublic static java.lang.String printInteger(java.math.BigInteger pValue)
Returns a lexical representation of the given instance of
BigInteger, which is an integer in arbitrary precision.
pValue - The integer value being converted.
PrintConversionEventpublic static java.lang.String printInt(int pValue)
Returns a lexical representation of the given primitive 32 bit integer.
pValue - The int value being converted.
PrintConversionEventpublic static java.lang.String printLong(long pValue)
Returns a lexical representation of the given primitive 64 bit integer.
pValue - The long value being converted.
PrintConversionEventpublic static java.lang.String printShort(short pValue)
Returns a lexical representation of the given primitive 16 bit integer.
pValue - The short value being converted.
PrintConversionEventpublic static java.lang.String printDecimal(java.math.BigDecimal pValue)
Returns a lexical representation of the given instance of
BigDecimal, which is a decimal number in arbitrary
precision.
pValue - The decimal value being converted.
PrintConversionEventpublic static java.lang.String printFloat(float pValue)
Returns a lexical representation of the given primitive 32 bit floating point number.
pValue - The float value being converted.
PrintConversionEventpublic static java.lang.String printDouble(double pValue)
Returns a lexical representation of the given primitive 64 bit floating point number.
pValue - The double value being converted.
PrintConversionEventpublic static java.lang.String printBoolean(boolean pValue)
Returns a lexical representation of the given primitive boolean value.
pValue - The boolean value being converted.
PrintConversionEventpublic static java.lang.String printByte(byte pValue)
Returns a lexical representation of the given primitive 8 bit integer.
pValue - The byte value being converted.
PrintConversionEvent
public static java.lang.String printQName(QName pValue,
NamespaceContext pNamespaceContext)
Returns a lexical representation of the given qualified name, which is a combination of namespace URI and local name. The lexical representation is an optional prefix, which is currently mapped to namespace URI of the qualified name, followed by a colon and the local name. If the namespace URI is the current default namespace URI, then the prefix and the colon may be omitted.
pValue - The qualified name being converted.pNamespaceContext - A mapping of prefixes to namespace
URI's which may be used to determine a valid prefix.
PrintConversionEventpublic static java.lang.String printDateTime(java.util.Calendar pValue)
Returns a lexical representation of the given dateTime value. Valid lexical representations include:
YYYY-MM-DDThh:mm:ss YYYY-MM-DDThh:mm:ss.sss YYYY-MM-DDThh:mm:ssZ YYYY-MM-DDThh:mm:ss-01:00The former examples are all specified in UTC time. The last example uses a negatice offset of one hour to UTC.
pValue - The dateTime value being converted
PrintConversionEventpublic static java.lang.String printBase64Binary(byte[] pValue)
Returns a lexical representation of the given byte array. The lexical representation is obtained by application of the base 64 encoding.
pValue - The byte array being converted.
PrintConversionEventpublic static java.lang.String printHexBinary(byte[] pValue)
Returns a lexical representation of the given byte array. The lexical representation is obtained by encoding any byte as two hex digits.
pValue - The byte array being converted.
PrintConversionEventpublic static java.lang.String printUnsignedInt(long pValue)
Returns a lexical representation of the given primitive, unsigned 32 bit integer.
pValue - The long value being converted.
PrintConversionEventpublic static java.lang.String printUnsignedShort(int pValue)
Returns a lexical representation of the given primitive, unsigned 16 bit integer.
pValue - The short value being converted.
PrintConversionEventpublic static java.lang.String printTime(java.util.Calendar pValue)
Returns a lexical representation of the given time value. Valid lexical representations include:
hh:mm:ss hh:mm:ss.sss hh:mm:ssZ hh:mm:ss-01:00The former examples are all specified in UTC time. The last example uses a negatice offset of one hour to UTC.
pValue - The time value being converted
PrintConversionEventpublic static java.lang.String printDate(java.util.Calendar pValue)
Returns a lexical representation of the given date value. Valid lexical representations include:
YYYY-MM-DD YYYY-MM-DDZ YYYY-MM-DD-01:00The former examples are all specified in UTC time. The last example uses a negatice offset of one hour to UTC.
pValue - The date value being converted
PrintConversionEventpublic static java.lang.String printAnySimpleType(java.lang.String pValue)
Returns a lexical representation of the given input string, which is the unmodified input string.
pValue - The input string.
PrintConversionEvent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||