< prev index next >

src/java.xml.bind/share/classes/javax/xml/bind/DatatypeConverter.java

Print this page




 277     /**
 278      * <p>
 279      * Converts the string argument into a byte value.
 280      * @param lexicalXSDByte
 281      *     A string containing lexical representation of
 282      *     xsd:byte.
 283      * @return
 284      *     A byte value represented by the string argument.
 285      * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:byte.
 286      */
 287     public static byte parseByte( String lexicalXSDByte ) {
 288         if (theConverter == null) initConverter();
 289         return theConverter.parseByte( lexicalXSDByte );
 290     }
 291 
 292     /**
 293      * <p>
 294      * Converts the string argument into a byte value.
 295      *
 296      * <p>
 297      * String parameter <tt>lexicalXSDQname</tt> must conform to lexical value space specifed at
 298      * <a href="http://www.w3.org/TR/xmlschema-2/#QName">XML Schema Part 2:Datatypes specification:QNames</a>
 299      *
 300      * @param lexicalXSDQName
 301      *     A string containing lexical representation of xsd:QName.
 302      * @param nsc
 303      *     A namespace context for interpreting a prefix within a QName.
 304      * @return
 305      *     A QName value represented by the string argument.
 306      * @throws IllegalArgumentException  if string parameter does not conform to XML Schema Part 2 specification or
 307      *      if namespace prefix of <tt>lexicalXSDQname</tt> is not bound to a URI in NamespaceContext <tt>nsc</tt>.
 308      */
 309     public static javax.xml.namespace.QName parseQName( String lexicalXSDQName,
 310                                                     NamespaceContext nsc) {
 311         if (theConverter == null) initConverter();
 312         return theConverter.parseQName( lexicalXSDQName, nsc );
 313     }
 314 
 315     /**
 316      * <p>
 317      * Converts the string argument into a Calendar value.
 318      * @param lexicalXSDDateTime
 319      *     A string containing lexical representation of
 320      *     xsd:datetime.
 321      * @return
 322      *     A Calendar object represented by the string argument.
 323      * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:dateTime.
 324      */
 325     public static java.util.Calendar parseDateTime( String lexicalXSDDateTime ) {
 326         if (theConverter == null) initConverter();
 327         return theConverter.parseDateTime( lexicalXSDDateTime );


 348      * @param lexicalXSDHexBinary
 349      *     A string containing lexical representation of
 350      *     xsd:hexBinary.
 351      * @return
 352      *     An array of bytes represented by the string argument.
 353      * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:hexBinary.
 354      */
 355    public static byte[] parseHexBinary( String lexicalXSDHexBinary ) {
 356         if (theConverter == null) initConverter();
 357         return theConverter.parseHexBinary( lexicalXSDHexBinary );
 358     }
 359 
 360     /**
 361      * <p>
 362      * Converts the string argument into a long value.
 363      * @param lexicalXSDUnsignedInt
 364      *     A string containing lexical representation
 365      *     of xsd:unsignedInt.
 366      * @return
 367      *     A long value represented by the string argument.
 368      * @throws NumberFormatException if string parameter can not be parsed into a <tt>long</tt> value.
 369      */
 370     public static long parseUnsignedInt( String lexicalXSDUnsignedInt ) {
 371         if (theConverter == null) initConverter();
 372         return theConverter.parseUnsignedInt( lexicalXSDUnsignedInt );
 373     }
 374 
 375     /**
 376      * <p>
 377      * Converts the string argument into an int value.
 378      * @param lexicalXSDUnsignedShort
 379      *     A string containing lexical
 380      *     representation of xsd:unsignedShort.
 381      * @return
 382      *     An int value represented by the string argument.
 383      * @throws NumberFormatException if string parameter can not be parsed into an <tt>int</tt> value.
 384      */
 385     public static int   parseUnsignedShort( String lexicalXSDUnsignedShort ) {
 386         if (theConverter == null) initConverter();
 387         return theConverter.parseUnsignedShort( lexicalXSDUnsignedShort );
 388     }
 389 
 390     /**
 391      * <p>
 392      * Converts the string argument into a Calendar value.
 393      * @param lexicalXSDTime
 394      *     A string containing lexical representation of
 395      *     xsd:time.
 396      * @return
 397      *     A Calendar value represented by the string argument.
 398      * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Time.
 399      */
 400     public static java.util.Calendar parseTime( String lexicalXSDTime ) {
 401         if (theConverter == null) initConverter();
 402         return theConverter.parseTime( lexicalXSDTime );
 403     }


 437      * @param val
 438      *     A string value.
 439      * @return
 440      *     A string containing a lexical representation of xsd:string.
 441      */
 442      // also indicate the print methods produce a lexical
 443      // representation for given Java datatypes.
 444 
 445     public static String printString( String val ) {
 446         if (theConverter == null) initConverter();
 447         return theConverter.printString( val );
 448     }
 449 
 450     /**
 451      * <p>
 452      * Converts a BigInteger value into a string.
 453      * @param val
 454      *     A BigInteger value
 455      * @return
 456      *     A string containing a lexical representation of xsd:integer
 457      * @throws IllegalArgumentException <tt>val</tt> is null.
 458      */
 459     public static String printInteger( java.math.BigInteger val ) {
 460         if (theConverter == null) initConverter();
 461         return theConverter.printInteger( val );
 462     }
 463 
 464     /**
 465      * <p>
 466      * Converts an int value into a string.
 467      * @param val
 468      *     An int value
 469      * @return
 470      *     A string containing a lexical representation of xsd:int
 471      */
 472     public static String printInt( int val ) {
 473         if (theConverter == null) initConverter();
 474         return theConverter.printInt( val );
 475     }
 476 
 477     /**


 490     /**
 491      * <p>
 492      * Converts a short value into a string.
 493      * @param val
 494      *     A short value
 495      * @return
 496      *     A string containing a lexical representation of xsd:short
 497      */
 498     public static String printShort( short val ) {
 499         if (theConverter == null) initConverter();
 500         return theConverter.printShort( val );
 501     }
 502 
 503     /**
 504      * <p>
 505      * Converts a BigDecimal value into a string.
 506      * @param val
 507      *     A BigDecimal value
 508      * @return
 509      *     A string containing a lexical representation of xsd:decimal
 510      * @throws IllegalArgumentException <tt>val</tt> is null.
 511      */
 512     public static String printDecimal( java.math.BigDecimal val ) {
 513         if (theConverter == null) initConverter();
 514         return theConverter.printDecimal( val );
 515     }
 516 
 517     /**
 518      * <p>
 519      * Converts a float value into a string.
 520      * @param val
 521      *     A float value
 522      * @return
 523      *     A string containing a lexical representation of xsd:float
 524      */
 525     public static String printFloat( float val ) {
 526         if (theConverter == null) initConverter();
 527         return theConverter.printFloat( val );
 528     }
 529 
 530     /**


 558      * Converts a byte value into a string.
 559      * @param val
 560      *     A byte value
 561      * @return
 562      *     A string containing a lexical representation of xsd:byte
 563      */
 564     public static String printByte( byte val ) {
 565         if (theConverter == null) initConverter();
 566         return theConverter.printByte( val );
 567     }
 568 
 569     /**
 570      * <p>
 571      * Converts a QName instance into a string.
 572      * @param val
 573      *     A QName value
 574      * @param nsc
 575      *     A namespace context for interpreting a prefix within a QName.
 576      * @return
 577      *     A string containing a lexical representation of QName
 578      * @throws IllegalArgumentException if <tt>val</tt> is null or
 579      * if <tt>nsc</tt> is non-null or <tt>nsc.getPrefix(nsprefixFromVal)</tt> is null.
 580      */
 581     public static String printQName( javax.xml.namespace.QName val,
 582                                      NamespaceContext nsc ) {
 583         if (theConverter == null) initConverter();
 584         return theConverter.printQName( val, nsc );
 585     }
 586 
 587     /**
 588      * <p>
 589      * Converts a Calendar value into a string.
 590      * @param val
 591      *     A Calendar value
 592      * @return
 593      *     A string containing a lexical representation of xsd:dateTime
 594      * @throws IllegalArgumentException if <tt>val</tt> is null.
 595      */
 596     public static String printDateTime( java.util.Calendar val ) {
 597         if (theConverter == null) initConverter();
 598         return theConverter.printDateTime( val );
 599     }
 600 
 601     /**
 602      * <p>
 603      * Converts an array of bytes into a string.
 604      * @param val
 605      *     An array of bytes
 606      * @return
 607      *     A string containing a lexical representation of xsd:base64Binary
 608      * @throws IllegalArgumentException if <tt>val</tt> is null.
 609      */
 610     public static String printBase64Binary( byte[] val ) {
 611         if (theConverter == null) initConverter();
 612         return theConverter.printBase64Binary( val );
 613     }
 614 
 615     /**
 616      * <p>
 617      * Converts an array of bytes into a string.
 618      * @param val
 619      *     An array of bytes
 620      * @return
 621      *     A string containing a lexical representation of xsd:hexBinary
 622      * @throws IllegalArgumentException if <tt>val</tt> is null.
 623      */
 624     public static String printHexBinary( byte[] val ) {
 625         if (theConverter == null) initConverter();
 626         return theConverter.printHexBinary( val );
 627     }
 628 
 629     /**
 630      * <p>
 631      * Converts a long value into a string.
 632      * @param val
 633      *     A long value
 634      * @return
 635      *     A string containing a lexical representation of xsd:unsignedInt
 636      */
 637     public static String printUnsignedInt( long val ) {
 638         if (theConverter == null) initConverter();
 639         return theConverter.printUnsignedInt( val );
 640     }
 641 
 642     /**
 643      * <p>
 644      * Converts an int value into a string.
 645      * @param val
 646      *     An int value
 647      * @return
 648      *     A string containing a lexical representation of xsd:unsignedShort
 649      */
 650     public static String printUnsignedShort( int val ) {
 651         if (theConverter == null) initConverter();
 652         return theConverter.printUnsignedShort( val );
 653     }
 654 
 655     /**
 656      * <p>
 657      * Converts a Calendar value into a string.
 658      * @param val
 659      *     A Calendar value
 660      * @return
 661      *     A string containing a lexical representation of xsd:time
 662      * @throws IllegalArgumentException if <tt>val</tt> is null.
 663      */
 664     public static String printTime( java.util.Calendar val ) {
 665         if (theConverter == null) initConverter();
 666         return theConverter.printTime( val );
 667     }
 668 
 669     /**
 670      * <p>
 671      * Converts a Calendar value into a string.
 672      * @param val
 673      *     A Calendar value
 674      * @return
 675      *     A string containing a lexical representation of xsd:date
 676      * @throws IllegalArgumentException if <tt>val</tt> is null.
 677      */
 678     public static String printDate( java.util.Calendar val ) {
 679         if (theConverter == null) initConverter();
 680         return theConverter.printDate( val );
 681     }
 682 
 683     /**
 684      * <p>
 685      * Converts a string value into a string.
 686      * @param val
 687      *     A string value
 688      * @return
 689      *     A string containing a lexical representation of xsd:AnySimpleType
 690      */
 691     public static String printAnySimpleType( String val ) {
 692         if (theConverter == null) initConverter();
 693         return theConverter.printAnySimpleType( val );
 694     }
 695 }


 277     /**
 278      * <p>
 279      * Converts the string argument into a byte value.
 280      * @param lexicalXSDByte
 281      *     A string containing lexical representation of
 282      *     xsd:byte.
 283      * @return
 284      *     A byte value represented by the string argument.
 285      * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:byte.
 286      */
 287     public static byte parseByte( String lexicalXSDByte ) {
 288         if (theConverter == null) initConverter();
 289         return theConverter.parseByte( lexicalXSDByte );
 290     }
 291 
 292     /**
 293      * <p>
 294      * Converts the string argument into a byte value.
 295      *
 296      * <p>
 297      * String parameter {@code lexicalXSDQname} must conform to lexical value space specifed at
 298      * <a href="http://www.w3.org/TR/xmlschema-2/#QName">XML Schema Part 2:Datatypes specification:QNames</a>
 299      *
 300      * @param lexicalXSDQName
 301      *     A string containing lexical representation of xsd:QName.
 302      * @param nsc
 303      *     A namespace context for interpreting a prefix within a QName.
 304      * @return
 305      *     A QName value represented by the string argument.
 306      * @throws IllegalArgumentException  if string parameter does not conform to XML Schema Part 2 specification or
 307      *      if namespace prefix of {@code lexicalXSDQname} is not bound to a URI in NamespaceContext {@code nsc}.
 308      */
 309     public static javax.xml.namespace.QName parseQName( String lexicalXSDQName,
 310                                                     NamespaceContext nsc) {
 311         if (theConverter == null) initConverter();
 312         return theConverter.parseQName( lexicalXSDQName, nsc );
 313     }
 314 
 315     /**
 316      * <p>
 317      * Converts the string argument into a Calendar value.
 318      * @param lexicalXSDDateTime
 319      *     A string containing lexical representation of
 320      *     xsd:datetime.
 321      * @return
 322      *     A Calendar object represented by the string argument.
 323      * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:dateTime.
 324      */
 325     public static java.util.Calendar parseDateTime( String lexicalXSDDateTime ) {
 326         if (theConverter == null) initConverter();
 327         return theConverter.parseDateTime( lexicalXSDDateTime );


 348      * @param lexicalXSDHexBinary
 349      *     A string containing lexical representation of
 350      *     xsd:hexBinary.
 351      * @return
 352      *     An array of bytes represented by the string argument.
 353      * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:hexBinary.
 354      */
 355    public static byte[] parseHexBinary( String lexicalXSDHexBinary ) {
 356         if (theConverter == null) initConverter();
 357         return theConverter.parseHexBinary( lexicalXSDHexBinary );
 358     }
 359 
 360     /**
 361      * <p>
 362      * Converts the string argument into a long value.
 363      * @param lexicalXSDUnsignedInt
 364      *     A string containing lexical representation
 365      *     of xsd:unsignedInt.
 366      * @return
 367      *     A long value represented by the string argument.
 368      * @throws NumberFormatException if string parameter can not be parsed into a {@code long} value.
 369      */
 370     public static long parseUnsignedInt( String lexicalXSDUnsignedInt ) {
 371         if (theConverter == null) initConverter();
 372         return theConverter.parseUnsignedInt( lexicalXSDUnsignedInt );
 373     }
 374 
 375     /**
 376      * <p>
 377      * Converts the string argument into an int value.
 378      * @param lexicalXSDUnsignedShort
 379      *     A string containing lexical
 380      *     representation of xsd:unsignedShort.
 381      * @return
 382      *     An int value represented by the string argument.
 383      * @throws NumberFormatException if string parameter can not be parsed into an {@code int} value.
 384      */
 385     public static int   parseUnsignedShort( String lexicalXSDUnsignedShort ) {
 386         if (theConverter == null) initConverter();
 387         return theConverter.parseUnsignedShort( lexicalXSDUnsignedShort );
 388     }
 389 
 390     /**
 391      * <p>
 392      * Converts the string argument into a Calendar value.
 393      * @param lexicalXSDTime
 394      *     A string containing lexical representation of
 395      *     xsd:time.
 396      * @return
 397      *     A Calendar value represented by the string argument.
 398      * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Time.
 399      */
 400     public static java.util.Calendar parseTime( String lexicalXSDTime ) {
 401         if (theConverter == null) initConverter();
 402         return theConverter.parseTime( lexicalXSDTime );
 403     }


 437      * @param val
 438      *     A string value.
 439      * @return
 440      *     A string containing a lexical representation of xsd:string.
 441      */
 442      // also indicate the print methods produce a lexical
 443      // representation for given Java datatypes.
 444 
 445     public static String printString( String val ) {
 446         if (theConverter == null) initConverter();
 447         return theConverter.printString( val );
 448     }
 449 
 450     /**
 451      * <p>
 452      * Converts a BigInteger value into a string.
 453      * @param val
 454      *     A BigInteger value
 455      * @return
 456      *     A string containing a lexical representation of xsd:integer
 457      * @throws IllegalArgumentException {@code val} is null.
 458      */
 459     public static String printInteger( java.math.BigInteger val ) {
 460         if (theConverter == null) initConverter();
 461         return theConverter.printInteger( val );
 462     }
 463 
 464     /**
 465      * <p>
 466      * Converts an int value into a string.
 467      * @param val
 468      *     An int value
 469      * @return
 470      *     A string containing a lexical representation of xsd:int
 471      */
 472     public static String printInt( int val ) {
 473         if (theConverter == null) initConverter();
 474         return theConverter.printInt( val );
 475     }
 476 
 477     /**


 490     /**
 491      * <p>
 492      * Converts a short value into a string.
 493      * @param val
 494      *     A short value
 495      * @return
 496      *     A string containing a lexical representation of xsd:short
 497      */
 498     public static String printShort( short val ) {
 499         if (theConverter == null) initConverter();
 500         return theConverter.printShort( val );
 501     }
 502 
 503     /**
 504      * <p>
 505      * Converts a BigDecimal value into a string.
 506      * @param val
 507      *     A BigDecimal value
 508      * @return
 509      *     A string containing a lexical representation of xsd:decimal
 510      * @throws IllegalArgumentException {@code val} is null.
 511      */
 512     public static String printDecimal( java.math.BigDecimal val ) {
 513         if (theConverter == null) initConverter();
 514         return theConverter.printDecimal( val );
 515     }
 516 
 517     /**
 518      * <p>
 519      * Converts a float value into a string.
 520      * @param val
 521      *     A float value
 522      * @return
 523      *     A string containing a lexical representation of xsd:float
 524      */
 525     public static String printFloat( float val ) {
 526         if (theConverter == null) initConverter();
 527         return theConverter.printFloat( val );
 528     }
 529 
 530     /**


 558      * Converts a byte value into a string.
 559      * @param val
 560      *     A byte value
 561      * @return
 562      *     A string containing a lexical representation of xsd:byte
 563      */
 564     public static String printByte( byte val ) {
 565         if (theConverter == null) initConverter();
 566         return theConverter.printByte( val );
 567     }
 568 
 569     /**
 570      * <p>
 571      * Converts a QName instance into a string.
 572      * @param val
 573      *     A QName value
 574      * @param nsc
 575      *     A namespace context for interpreting a prefix within a QName.
 576      * @return
 577      *     A string containing a lexical representation of QName
 578      * @throws IllegalArgumentException if {@code val} is null or
 579      * if {@code nsc} is non-null or {@code nsc.getPrefix(nsprefixFromVal)} is null.
 580      */
 581     public static String printQName( javax.xml.namespace.QName val,
 582                                      NamespaceContext nsc ) {
 583         if (theConverter == null) initConverter();
 584         return theConverter.printQName( val, nsc );
 585     }
 586 
 587     /**
 588      * <p>
 589      * Converts a Calendar value into a string.
 590      * @param val
 591      *     A Calendar value
 592      * @return
 593      *     A string containing a lexical representation of xsd:dateTime
 594      * @throws IllegalArgumentException if {@code val} is null.
 595      */
 596     public static String printDateTime( java.util.Calendar val ) {
 597         if (theConverter == null) initConverter();
 598         return theConverter.printDateTime( val );
 599     }
 600 
 601     /**
 602      * <p>
 603      * Converts an array of bytes into a string.
 604      * @param val
 605      *     An array of bytes
 606      * @return
 607      *     A string containing a lexical representation of xsd:base64Binary
 608      * @throws IllegalArgumentException if {@code val} is null.
 609      */
 610     public static String printBase64Binary( byte[] val ) {
 611         if (theConverter == null) initConverter();
 612         return theConverter.printBase64Binary( val );
 613     }
 614 
 615     /**
 616      * <p>
 617      * Converts an array of bytes into a string.
 618      * @param val
 619      *     An array of bytes
 620      * @return
 621      *     A string containing a lexical representation of xsd:hexBinary
 622      * @throws IllegalArgumentException if {@code val} is null.
 623      */
 624     public static String printHexBinary( byte[] val ) {
 625         if (theConverter == null) initConverter();
 626         return theConverter.printHexBinary( val );
 627     }
 628 
 629     /**
 630      * <p>
 631      * Converts a long value into a string.
 632      * @param val
 633      *     A long value
 634      * @return
 635      *     A string containing a lexical representation of xsd:unsignedInt
 636      */
 637     public static String printUnsignedInt( long val ) {
 638         if (theConverter == null) initConverter();
 639         return theConverter.printUnsignedInt( val );
 640     }
 641 
 642     /**
 643      * <p>
 644      * Converts an int value into a string.
 645      * @param val
 646      *     An int value
 647      * @return
 648      *     A string containing a lexical representation of xsd:unsignedShort
 649      */
 650     public static String printUnsignedShort( int val ) {
 651         if (theConverter == null) initConverter();
 652         return theConverter.printUnsignedShort( val );
 653     }
 654 
 655     /**
 656      * <p>
 657      * Converts a Calendar value into a string.
 658      * @param val
 659      *     A Calendar value
 660      * @return
 661      *     A string containing a lexical representation of xsd:time
 662      * @throws IllegalArgumentException if {@code val} is null.
 663      */
 664     public static String printTime( java.util.Calendar val ) {
 665         if (theConverter == null) initConverter();
 666         return theConverter.printTime( val );
 667     }
 668 
 669     /**
 670      * <p>
 671      * Converts a Calendar value into a string.
 672      * @param val
 673      *     A Calendar value
 674      * @return
 675      *     A string containing a lexical representation of xsd:date
 676      * @throws IllegalArgumentException if {@code val} is null.
 677      */
 678     public static String printDate( java.util.Calendar val ) {
 679         if (theConverter == null) initConverter();
 680         return theConverter.printDate( val );
 681     }
 682 
 683     /**
 684      * <p>
 685      * Converts a string value into a string.
 686      * @param val
 687      *     A string value
 688      * @return
 689      *     A string containing a lexical representation of xsd:AnySimpleType
 690      */
 691     public static String printAnySimpleType( String val ) {
 692         if (theConverter == null) initConverter();
 693         return theConverter.printAnySimpleType( val );
 694     }
 695 }
< prev index next >