Javax.xml.bind.DatatypeConverter Class



Introduction

The javax.xml.bind.DatatypeConverter class makes it easier to write parse and print methods.These methods are invoked by custom parse and print methods.Following are the important points about DatatypeConverter −

  • It defines static parse and print methods that provide access to a JAXB provider's implementation of parse and print methods.

  • The static methods defined in the class can also be used to specify a parse or a print method in a javaType binding declaration.

Class declaration

Following is the declaration for javax.xml.bind.DatatypeConverter class −

public final class DatatypeConverter
   extends Object

Class methods

S.N. Method & Description
1

static String parseAnySimpleType(String lexicalXSDAnySimpleType)

This method returns a string containing the lexical representation of the simple type.

2

static byte[] parseBase64Binary(String lexicalXSDBase64Binary)

This method converts the string argument into an array of bytes.

3

static boolean parseBoolean(String lexicalXSDBoolean)

This method converts the string argument into a boolean value.

4

static byte parseByte(String lexicalXSDByte)

This method converts the string argument into a byte value.

5

static Calendar parseDate(String lexicalXSDDate)

This method converts the string argument into a Calendar value.

6

static Calendar parseDateTime(String lexicalXSDDateTime)

This method converts the string argument into a Calendar value.

7

static BigDecimal parseDecimal(String lexicalXSDDecimal)

This method converts the string argument into a BigDecimal value.

8

static double parseDouble(String lexicalXSDDouble)

This method converts the string argument into a double value.

9

static float parseFloat(String lexicalXSDFloat)

This method converts the string argument into a float value.

10

static byte[] parseHexBinary(String lexicalXSDHexBinary)

This method converts the string argument into an array of bytes.

11 static int parseInt(String lexicalXSDInt)

This method converts the string argument into an int value.

12

static BigInteger parseInteger(String lexicalXSDInteger)

This method converts the string argument into a BigInteger value.

13

static long parseLong(String lexicalXSDLong)

This method converts the string argument into a long value.

14

static QName parseQName(String lexicalXSDQName, NamespaceContext nsc)

This method converts the string argument into a byte value.

15

static short parseShort(String lexicalXSDShort)

This method converts the string argument into a short value.

16

static String parseString(String lexicalXSDString)

This method converts the lexical XSD string argument into a String value.

17

static Calendar parseTime(String lexicalXSDTime)

This method converts the string argument into a Calendar value.

18

static long parseUnsignedInt(String lexicalXSDUnsignedInt)

This method converts the string argument into a long value.

19

static int parseUnsignedShort(String lexicalXSDUnsignedShort)

This method converts the string argument into an int value.

20

static String printAnySimpleType(String val)

This method converts a string value into a string.

21

static String printBase64Binary(byte[] val)

This method converts an array of bytes into a string.

22

static String printBoolean(boolean val)

This method converts a boolean value into a string.

23

static String printByte(byte val)

This method converts a byte value into a string.

24

static String printDate(Calendar val)

This method converts a Calendar value into a string.

25

static String printDateTime(Calendar val)

This method converts a Calendar value into a string.

26

static String printDecimal(BigDecimal val)

This method converts a BigDecimal value into a string.

27

static String printDouble(double val)

This method converts a double value into a string.

28

static String printFloat(float val)

This method converts a float value into a string.

29

static String printHexBinary(byte[] val)

This method converts an array of bytes into a string.

30 static String printInt(int val)

This method converts an int value into a string.

31

static String printInteger(BigInteger val)

This method converts a BigInteger value into a string.

32

static String printLong(long val)

This method converts a long value into a string.

33

static String printQName(QName val, NamespaceContext nsc)

This method converts a QName instance into a string.

34

static String printShort(short val)

This method converts a short value into a string.

35 static String printString(String val)

This method converts the string argument into a string.

36

static String printTime(Calendar val)

This method converts a Calendar value into a string.

37

static String printUnsignedInt(long val)

This method converts a long value into a string.

38

static String printUnsignedShort(int val)

This method converts an int value into a string.

39

static void setDatatypeConverter(DatatypeConverterInterface converter)

his method is for JAXB provider use only.

Methods inherited

This class inherits methods from the following classes −

javax.xml.Object

Advertisements