Class DatatypeConverterImpl

java.lang.Object
org.glassfish.jaxb.runtime.DatatypeConverterImpl
All Implemented Interfaces:
DatatypeConverterInterface

@Deprecated public final class DatatypeConverterImpl extends Object implements DatatypeConverterInterface
Deprecated.
in JAXB 2.2.4 - use jakarta.xml.bind.DatatypeConverterImpl instead or let us know why you can't
This class is the JAXB RI's default implementation of the DatatypeConverterInterface.

When client applications specify the use of the static print/parse methods in DatatypeConverter, it will delegate to this class.

This class is responsible for whitespace normalization.

Since:
JAXB 1.0
Author:
  • Ryan Shoemaker, Martin Grebac
  • Field Details

  • Constructor Details

    • DatatypeConverterImpl

      protected DatatypeConverterImpl()
      Deprecated.
  • Method Details

    • _parseInteger

      public static BigInteger _parseInteger(CharSequence s)
      Deprecated.
    • _printInteger

      public static String _printInteger(BigInteger val)
      Deprecated.
    • _parseInt

      public static int _parseInt(CharSequence s)
      Deprecated.
      Faster but less robust String->int conversion. Note that:
      1. XML Schema allows '+', but Integer.valueOf(String) is not.
      2. XML Schema allows leading and trailing (but not in-between) whitespaces. Integer.valueOf(String) doesn't allow any.
    • _parseLong

      public static long _parseLong(CharSequence s)
      Deprecated.
    • _parseShort

      public static short _parseShort(CharSequence s)
      Deprecated.
    • _printShort

      public static String _printShort(short val)
      Deprecated.
    • _parseDecimal

      public static BigDecimal _parseDecimal(CharSequence content)
      Deprecated.
    • _parseFloat

      public static float _parseFloat(CharSequence _val)
      Deprecated.
    • _printFloat

      public static String _printFloat(float v)
      Deprecated.
    • _parseDouble

      public static double _parseDouble(CharSequence _val)
      Deprecated.
    • _parseBoolean

      public static Boolean _parseBoolean(CharSequence literal)
      Deprecated.
    • _printBoolean

      public static String _printBoolean(boolean val)
      Deprecated.
    • _parseByte

      public static byte _parseByte(CharSequence literal)
      Deprecated.
    • _printByte

      public static String _printByte(byte val)
      Deprecated.
    • _parseQName

      public static QName _parseQName(CharSequence text, NamespaceContext nsc)
      Deprecated.
      Returns:
      null if fails to convert.
    • _parseDateTime

      public static GregorianCalendar _parseDateTime(CharSequence s)
      Deprecated.
    • _printDateTime

      public static String _printDateTime(Calendar val)
      Deprecated.
    • _printDate

      public static String _printDate(Calendar val)
      Deprecated.
    • _printInt

      public static String _printInt(int val)
      Deprecated.
    • _printLong

      public static String _printLong(long val)
      Deprecated.
    • _printDecimal

      public static String _printDecimal(BigDecimal val)
      Deprecated.
    • _printDouble

      public static String _printDouble(double v)
      Deprecated.
    • _printQName

      public static String _printQName(QName val, NamespaceContext nsc)
      Deprecated.
    • _parseBase64Binary

      public static byte[] _parseBase64Binary(String text)
      Deprecated.
      Parameters:
      text - base64Binary data is likely to be long, and decoding requires each character to be accessed twice (once for counting length, another for decoding.) A benchmark showed that taking String is faster, presumably because JIT can inline a lot of string access (with data of 1K chars, it was twice as fast)
    • encode

      public static char encode(int i)
      Deprecated.
    • encodeByte

      public static byte encodeByte(int i)
      Deprecated.
    • _printBase64Binary

      public static String _printBase64Binary(byte[] input)
      Deprecated.
    • _printBase64Binary

      public static String _printBase64Binary(byte[] input, int offset, int len)
      Deprecated.
    • _printBase64Binary

      public static int _printBase64Binary(byte[] input, int offset, int len, char[] buf, int ptr)
      Deprecated.
      Encodes a byte array into a char array by doing base64 encoding. The caller must supply a big enough buffer.
      Returns:
      the value of ptr+((len+2)/3)*4, which is the new offset in the output buffer where the further bytes should be placed.
    • _printBase64Binary

      public static void _printBase64Binary(byte[] input, int offset, int len, XMLStreamWriter output) throws XMLStreamException
      Deprecated.
      Throws:
      XMLStreamException
    • _printBase64Binary

      public static int _printBase64Binary(byte[] input, int offset, int len, byte[] out, int ptr)
      Deprecated.
      Encodes a byte array into another byte array by first doing base64 encoding then encoding the result in ASCII. The caller must supply a big enough buffer.
      Returns:
      the value of ptr+((len+2)/3)*4, which is the new offset in the output buffer where the further bytes should be placed.
    • getDatatypeFactory

      public static DatatypeFactory getDatatypeFactory()
      Deprecated.
    • parseString

      @Deprecated public String parseString(String lexicalXSDString)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Convert the string argument into a string.
      Specified by:
      parseString in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDString - A lexical representation of the XML Schema datatype xsd:string
      Returns:
      A string that is the same as the input string.
    • parseInteger

      @Deprecated public BigInteger parseInteger(String lexicalXSDInteger)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Convert the string argument into a BigInteger value.
      Specified by:
      parseInteger in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDInteger - A string containing a lexical representation of xsd:integer.
      Returns:
      A BigInteger value represented by the string argument.
    • printInteger

      @Deprecated public String printInteger(BigInteger val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a BigInteger value into a string.
      Specified by:
      printInteger in interface DatatypeConverterInterface
      Parameters:
      val - A BigInteger value
      Returns:
      A string containing a lexical representation of xsd:integer
    • parseInt

      @Deprecated public int parseInt(String s)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Convert the string argument into an int value.
      Specified by:
      parseInt in interface DatatypeConverterInterface
      Parameters:
      s - A string containing a lexical representation of xsd:int.
      Returns:
      An int value represented byte the string argument.
    • parseLong

      @Deprecated public long parseLong(String lexicalXSLong)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into a long value.
      Specified by:
      parseLong in interface DatatypeConverterInterface
      Parameters:
      lexicalXSLong - A string containing lexical representation of xsd:long.
      Returns:
      A long value represented by the string argument.
    • parseShort

      @Deprecated public short parseShort(String lexicalXSDShort)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into a short value.
      Specified by:
      parseShort in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDShort - A string containing lexical representation of xsd:short.
      Returns:
      A short value represented by the string argument.
    • printShort

      @Deprecated public String printShort(short val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a short value into a string.
      Specified by:
      printShort in interface DatatypeConverterInterface
      Parameters:
      val - A short value
      Returns:
      A string containing a lexical representation of xsd:short
    • parseDecimal

      @Deprecated public BigDecimal parseDecimal(String content)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into a BigDecimal value.
      Specified by:
      parseDecimal in interface DatatypeConverterInterface
      Parameters:
      content - A string containing lexical representation of xsd:decimal.
      Returns:
      A BigDecimal value represented by the string argument.
    • parseFloat

      @Deprecated public float parseFloat(String lexicalXSDFloat)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into a float value.
      Specified by:
      parseFloat in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDFloat - A string containing lexical representation of xsd:float.
      Returns:
      A float value represented by the string argument.
    • printFloat

      @Deprecated public String printFloat(float v)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a float value into a string.
      Specified by:
      printFloat in interface DatatypeConverterInterface
      Parameters:
      v - A float value
      Returns:
      A string containing a lexical representation of xsd:float
    • parseDouble

      @Deprecated public double parseDouble(String lexicalXSDDouble)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into a double value.
      Specified by:
      parseDouble in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDDouble - A string containing lexical representation of xsd:double.
      Returns:
      A double value represented by the string argument.
    • parseBoolean

      @Deprecated public boolean parseBoolean(String lexicalXSDBoolean)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into a boolean value.
      Specified by:
      parseBoolean in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDBoolean - A string containing lexical representation of xsd:boolean.
      Returns:
      A boolean value represented by the string argument.
    • printBoolean

      @Deprecated public String printBoolean(boolean val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a boolean value into a string.
      Specified by:
      printBoolean in interface DatatypeConverterInterface
      Parameters:
      val - A boolean value
      Returns:
      A string containing a lexical representation of xsd:boolean
    • parseByte

      @Deprecated public byte parseByte(String lexicalXSDByte)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into a byte value.
      Specified by:
      parseByte in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDByte - A string containing lexical representation of xsd:byte.
      Returns:
      A byte value represented by the string argument.
    • printByte

      @Deprecated public String printByte(byte val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a byte value into a string.
      Specified by:
      printByte in interface DatatypeConverterInterface
      Parameters:
      val - A byte value
      Returns:
      A string containing a lexical representation of xsd:byte
    • parseQName

      @Deprecated public QName parseQName(String lexicalXSDQName, NamespaceContext nsc)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      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

      Specified by:
      parseQName in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDQName - A string containing lexical representation of xsd:QName.
      nsc - A namespace context for interpreting a prefix within a QName.
      Returns:
      A QName value represented by the string argument.
    • parseDateTime

      @Deprecated public Calendar parseDateTime(String lexicalXSDDateTime)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into a Calendar value.
      Specified by:
      parseDateTime in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDDateTime - A string containing lexical representation of xsd:datetime.
      Returns:
      A Calendar object represented by the string argument.
    • printDateTime

      @Deprecated public String printDateTime(Calendar val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a Calendar value into a string.
      Specified by:
      printDateTime in interface DatatypeConverterInterface
      Parameters:
      val - A Calendar value
      Returns:
      A string containing a lexical representation of xsd:dateTime
    • parseBase64Binary

      @Deprecated public byte[] parseBase64Binary(String lexicalXSDBase64Binary)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into an array of bytes.
      Specified by:
      parseBase64Binary in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDBase64Binary - A string containing lexical representation of xsd:base64Binary.
      Returns:
      An array of bytes represented by the string argument.
    • parseHexBinary

      @Deprecated public byte[] parseHexBinary(String s)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into an array of bytes.
      Specified by:
      parseHexBinary in interface DatatypeConverterInterface
      Parameters:
      s - A string containing lexical representation of xsd:hexBinary.
      Returns:
      An array of bytes represented by the string argument.
    • printHexBinary

      @Deprecated public String printHexBinary(byte[] data)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts an array of bytes into a string.
      Specified by:
      printHexBinary in interface DatatypeConverterInterface
      Parameters:
      data - an array of bytes
      Returns:
      A string containing a lexical representation of xsd:hexBinary
    • parseUnsignedInt

      @Deprecated public long parseUnsignedInt(String lexicalXSDUnsignedInt)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into a long value.
      Specified by:
      parseUnsignedInt in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDUnsignedInt - A string containing lexical representation of xsd:unsignedInt.
      Returns:
      A long value represented by the string argument.
    • printUnsignedInt

      @Deprecated public String printUnsignedInt(long val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a long value into a string.
      Specified by:
      printUnsignedInt in interface DatatypeConverterInterface
      Parameters:
      val - A long value
      Returns:
      A string containing a lexical representation of xsd:unsignedInt
    • parseUnsignedShort

      @Deprecated public int parseUnsignedShort(String lexicalXSDUnsignedShort)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into an int value.
      Specified by:
      parseUnsignedShort in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDUnsignedShort - A string containing lexical representation of xsd:unsignedShort.
      Returns:
      An int value represented by the string argument.
    • parseTime

      @Deprecated public Calendar parseTime(String lexicalXSDTime)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into a Calendar value.
      Specified by:
      parseTime in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDTime - A string containing lexical representation of xsd:Time.
      Returns:
      A Calendar value represented by the string argument.
    • printTime

      @Deprecated public String printTime(Calendar val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a Calendar value into a string.
      Specified by:
      printTime in interface DatatypeConverterInterface
      Parameters:
      val - A Calendar value
      Returns:
      A string containing a lexical representation of xsd:time
    • parseDate

      @Deprecated public Calendar parseDate(String lexicalXSDDate)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into a Calendar value.
      Specified by:
      parseDate in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDDate - A string containing lexical representation of xsd:Date.
      Returns:
      A Calendar value represented by the string argument.
    • printDate

      @Deprecated public String printDate(Calendar val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a Calendar value into a string.
      Specified by:
      printDate in interface DatatypeConverterInterface
      Parameters:
      val - A Calendar value
      Returns:
      A string containing a lexical representation of xsd:date
    • parseAnySimpleType

      @Deprecated public String parseAnySimpleType(String lexicalXSDAnySimpleType)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Return a string containing the lexical representation of the simple type.
      Specified by:
      parseAnySimpleType in interface DatatypeConverterInterface
      Parameters:
      lexicalXSDAnySimpleType - A string containing lexical representation of the simple type.
      Returns:
      A string containing the lexical representation of the simple type.
    • printString

      @Deprecated public String printString(String val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts the string argument into a string.
      Specified by:
      printString in interface DatatypeConverterInterface
      Parameters:
      val - A string value.
      Returns:
      A string containing a lexical representation of xsd:string
    • printInt

      @Deprecated public String printInt(int val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts an int value into a string.
      Specified by:
      printInt in interface DatatypeConverterInterface
      Parameters:
      val - An int value
      Returns:
      A string containing a lexical representation of xsd:int
    • printLong

      @Deprecated public String printLong(long val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a long value into a string.
      Specified by:
      printLong in interface DatatypeConverterInterface
      Parameters:
      val - A long value
      Returns:
      A string containing a lexical representation of xsd:long
    • printDecimal

      @Deprecated public String printDecimal(BigDecimal val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a BigDecimal value into a string.
      Specified by:
      printDecimal in interface DatatypeConverterInterface
      Parameters:
      val - A BigDecimal value
      Returns:
      A string containing a lexical representation of xsd:decimal
    • printDouble

      @Deprecated public String printDouble(double v)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a double value into a string.
      Specified by:
      printDouble in interface DatatypeConverterInterface
      Parameters:
      v - A double value
      Returns:
      A string containing a lexical representation of xsd:double
    • printQName

      @Deprecated public String printQName(QName val, NamespaceContext nsc)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a QName instance into a string.
      Specified by:
      printQName in interface DatatypeConverterInterface
      Parameters:
      val - A QName value
      nsc - A namespace context for interpreting a prefix within a QName.
      Returns:
      A string containing a lexical representation of QName
    • printBase64Binary

      @Deprecated public String printBase64Binary(byte[] val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts an array of bytes into a string.
      Specified by:
      printBase64Binary in interface DatatypeConverterInterface
      Parameters:
      val - an array of bytes
      Returns:
      A string containing a lexical representation of xsd:base64Binary
    • printUnsignedShort

      @Deprecated public String printUnsignedShort(int val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts an int value into a string.
      Specified by:
      printUnsignedShort in interface DatatypeConverterInterface
      Parameters:
      val - An int value
      Returns:
      A string containing a lexical representation of xsd:unsignedShort
    • printAnySimpleType

      @Deprecated public String printAnySimpleType(String val)
      Deprecated.
      Description copied from interface: DatatypeConverterInterface
      Converts a string value into a string.
      Specified by:
      printAnySimpleType in interface DatatypeConverterInterface
      Parameters:
      val - A string value
      Returns:
      A string containing a lexical representation of xsd:AnySimpleType