|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.xml.bind Class DatatypeConverter
java.lang.Object javax.xml.bind.DatatypeConverter
public final class DatatypeConverter
- extends Object
可以使用 javaType 绑定声明来自定义 XML 模式数据类型到 Java 数据类型的绑定。自定义可能涉及编写分别用来解析和打印 XML 模式数据类型的词汇表示形式的 parse 和 print 方法。不过,编写 parse 和 print 方法需要了解词汇表示形式( XML Schema Part2: Datatypes 规范),因此可能很难编写。
此类使编写 parse 和 print 方法变得更容易。它定义了静态 parse 和 print 方法,以便访问 JAXB 提供者的 parse 和 print 方法的实现。这些方法由自定义 parse 和 print 方法调用。例如,可以使用如下 parse 和 print 方法来自定义 xsd:dateTime 到 long 值的绑定:
// Customized parse method public long myParseCal( String dateTimeString ) { java.util.Calendar cal = DatatypeConverter.parseDateTime(dateTimeString); long longval = convert_calendar_to_long(cal); //application specific return longval; } // Customized print method public String myPrintCal( Long longval ) { java.util.Calendar cal = convert_long_to_calendar(longval) ; //application specific String dateTimeString = DatatypeConverter.printDateTime(cal); return dateTimeString; }
在 DatatypeConverterInterface
中有分别对应于每个 parse 和 print 方法的静态 parse 和 print 方法。
在该类中定义的静态方法还可以用于指定 javaType 绑定声明中的 parse 和 print 方法。
JAXB 提供者需要在第一次执行编组或解组操作之前(可能是在调用 JAXBContext.newInstance 期间)的某个时间点调用 setDatatypeConverter
API。要配置用于执行打印和解析功能的转换器,这一步是必需的。
XML 模式数据类型的 print 方法可以输出对于 XML 模式数据类型有效的任何词汇表示形式。如果在转换期间发生错误,则该方法将抛出 IllegalArgumentException,或者抛出 IllegalArgumentException 的子类。
version |
| |
since | JAXB1.0 | |
See also | javax.xml.bind.DatatypeConverterInterface, javax.xml.bind.ParseConversionEvent, javax.xml.bind.PrintConversionEvent |
The javaType binding declaration can be used to customize the binding of an XML schema datatype to a Java datatype. Customizations can involve writing a parse and print method for parsing and printing lexical representations of a XML schema datatype respectively. However, writing parse and print methods requires knowledge of the lexical representations ( XML Schema Part2: Datatypes specification ) and hence may be difficult to write.
This class makes it easier to write parse and print methods. It defines static parse and print methods that provide access to a JAXB provider's implementation of parse and print methods. These methods are invoked by custom parse and print methods. For example, the binding of xsd:dateTime to a long can be customized using parse and print methods as follows:
// Customized parse method public long myParseCal( String dateTimeString ) { java.util.Calendar cal = DatatypeConverter.parseDateTime(dateTimeString); long longval = convert_calendar_to_long(cal); //application specific return longval; } // Customized print method public String myPrintCal( Long longval ) { java.util.Calendar cal = convert_long_to_calendar(longval) ; //application specific String dateTimeString = DatatypeConverter.printDateTime(cal); return dateTimeString; }
There is a static parse and print method corresponding to each parse and
print method respectively in the DatatypeConverterInterface
.
The static methods defined in the class can also be used to specify a parse or a print method in a javaType binding declaration.
JAXB Providers are required to call the
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.
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.
- Since:
- JAXB1.0
- Version:
- $Revision: 1.3 $
- Author:
- Sekhar Vajjhala, Sun Microsystems, Inc.
- Joe Fialli, Sun Microsystems Inc.
- Kohsuke Kawaguchi, Sun Microsystems, Inc.
- Ryan Shoemaker,Sun Microsystems Inc.
- See Also:
DatatypeConverterInterface
,ParseConversionEvent
,PrintConversionEvent
Method Summary | |
---|---|
static String |
parseAnySimpleType(String lexicalXSDAnySimpleType)
Return a string containing the lexical representation of the simple type. |
static byte[] |
parseBase64Binary(String lexicalXSDBase64Binary)
Converts the string argument into an array of bytes. |
static boolean |
parseBoolean(String lexicalXSDBoolean)
Converts the string argument into a boolean value. |
static byte |
parseByte(String lexicalXSDByte)
Converts the string argument into a byte value. |
static Calendar |
parseDate(String lexicalXSDDate)
Converts the string argument into a Calendar value. |
static Calendar |
parseDateTime(String lexicalXSDDateTime)
Converts the string argument into a Calendar value. |
static BigDecimal |
parseDecimal(String lexicalXSDDecimal)
Converts the string argument into a BigDecimal value. |
static double |
parseDouble(String lexicalXSDDouble)
Converts the string argument into a double value. |
static float |
parseFloat(String lexicalXSDFloat)
Converts the string argument into a float value. |
static byte[] |
parseHexBinary(String lexicalXSDHexBinary)
Converts the string argument into an array of bytes. |
static int |
parseInt(String lexicalXSDInt)
Convert the string argument into an int value. |
static BigInteger |
parseInteger(String lexicalXSDInteger)
Convert the string argument into a BigInteger value. |
static long |
parseLong(String lexicalXSDLong)
Converts the string argument into a long value. |
static QName |
parseQName(String lexicalXSDQName,
NamespaceContext nsc)
Converts the string argument into a byte value. |
static short |
parseShort(String lexicalXSDShort)
Converts the string argument into a short value. |
static String |
parseString(String lexicalXSDString)
Convert the lexical XSD string argument into a String value. |
static Calendar |
parseTime(String lexicalXSDTime)
Converts the string argument into a Calendar value. |
static long |
parseUnsignedInt(String lexicalXSDUnsignedInt)
Converts the string argument into a long value. |
static int |
parseUnsignedShort(String lexicalXSDUnsignedShort)
Converts the string argument into an int value. |
static String |
printAnySimpleType(String val)
Converts a string value into a string. |
static String |
printBase64Binary(byte[] val)
Converts an array of bytes into a string. |
static String |
printBoolean(boolean val)
Converts a boolean value into a string. |
static String |
printByte(byte val)
Converts a byte value into a string. |
static String |
printDate(Calendar val)
Converts a Calendar value into a string. |
static String |
printDateTime(Calendar val)
Converts a Calendar value into a string. |
static String |
printDecimal(BigDecimal val)
Converts a BigDecimal value into a string. |
static String |
printDouble(double val)
Converts a double value into a string. |
static String |
printFloat(float val)
Converts a float value into a string. |
static String |
printHexBinary(byte[] val)
Converts an array of bytes into a string. |
static String |
printInt(int val)
Converts an int value into a string. |
static String |
printInteger(BigInteger val)
Converts a BigInteger value into a string. |
static String |
printLong(long val)
Converts A long value into a string. |
static String |
printQName(QName val,
NamespaceContext nsc)
Converts a QName instance into a string. |
static String |
printShort(short val)
Converts a short value into a string. |
static String |
printString(String val)
Converts the string argument into a string. |
static String |
printTime(Calendar val)
Converts a Calendar value into a string. |
static String |
printUnsignedInt(long val)
Converts a long value into a string. |
static String |
printUnsignedShort(int val)
Converts an int value into a string. |
static void |
setDatatypeConverter(DatatypeConverterInterface converter)
This method is for JAXB provider use only. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void
setDatatypeConverter(DatatypeConverterInterface converter)
此方法仅适用于 JAXB 提供者。
JAXB 提供者需要在允许执行任何 JAXB 客户端编组或解组操作之前的某个时间点调用此方法。要配置用于执行打印和解析功能的转换器,这一步是必需的。
重复调用此 API 是无效的,传入第一次调用中的 DatatypeConverterInterface 实例将始终用于后续调用。
converter | 实现 DatatypeConverterInterface 类的类实例,此参数不能为 null。 |
Throws | IllegalArgumentException: 如果参数为 null |
setDatatypeConverter
public static void setDatatypeConverter(DatatypeConverterInterface converter)
- This method is for JAXB provider use only.
JAXB Providers are required to call this method at some point before allowing any of the JAXB client marshal or unmarshal operations to occur. This is necessary to configure the datatype converter that should be used to perform the print and parse conversions.
Calling this api repeatedly will have no effect - the DatatypeConverterInterface instance passed into the first invocation is the one that will be used from then on.
- Parameters:
converter
- an instance of a class that implements the DatatypeConverterInterface class - this parameter must not be null.- Throws:
IllegalArgumentException
- if the parameter is null
public static String
parseString(String lexicalXSDString)
将词汇 XSD 字符串参数转换为一个 String 值。
lexicalXSDString | 包含 xsd:string 的词汇表示形式的字符串。 |
return | 字符串参数表示的 String 值。 |
parseString
public static String parseString(String lexicalXSDString)
Convert the lexical XSD string argument into a String value.
- Parameters:
lexicalXSDString
- A string containing a lexical representation of xsd:string.- Returns:
- A String value represented by the string argument.
public static java.math.BigInteger
parseInteger(String lexicalXSDInteger)
将字符串参数转换为一个 BigInteger 值。
lexicalXSDInteger | 包含 xsd:integer 的词汇表示形式的字符串。 |
return | 字符串参数表示的 BigInteger 值。 |
Throws | NumberFormatException:
如果 lexicalXSDInteger 不是 java.math.BigInteger 值的有效字符串表示形式。 |
parseInteger
public static BigInteger parseInteger(String lexicalXSDInteger)
Convert the string argument into a BigInteger value.
- Parameters:
lexicalXSDInteger
- A string containing a lexical representation of xsd:integer.- Returns:
- A BigInteger value represented by the string argument.
- Throws:
NumberFormatException
-lexicalXSDInteger
is not a valid string representation of aBigInteger
value.
public static int
parseInt(String lexicalXSDInt)
将字符串参数转换为一个 int 值。
lexicalXSDInt | 包含 xsd:int 的词汇表示形式的字符串。 |
return | 字符串参数表示的 int 值。 |
Throws | NumberFormatException:
如果 lexicalXSDInt 不是 int 值的有效字符串表示形式。 |
parseInt
public static int parseInt(String lexicalXSDInt)
Convert the string argument into an int value.
- Parameters:
lexicalXSDInt
- A string containing a lexical representation of xsd:int.- Returns:
- A int value represented by the string argument.
- Throws:
NumberFormatException
-lexicalXSDInt
is not a valid string representation of anint
value.
public static long
parseLong(String lexicalXSDLong)
将字符串参数转换为一个 long 值。
lexicalXSDLong | 包含 xsd:long 的词汇表示形式的字符串。 |
return | 字符串参数表示的 long 值。 |
Throws | NumberFormatException:
如果 lexicalXSDLong 不是 long 值的有效字符串表示形式。 |
parseLong
public static long parseLong(String lexicalXSDLong)
Converts the string argument into a long value.
- Parameters:
lexicalXSDLong
- A string containing lexical representation of xsd:long.- Returns:
- A long value represented by the string argument.
- Throws:
NumberFormatException
-lexicalXSDLong
is not a valid string representation of along
value.
public static short
parseShort(String lexicalXSDShort)
将字符串参数转换为一个 short 值。
lexicalXSDShort | 包含 xsd:short 的词汇表示形式的字符串。 |
return | 字符串参数表示的 short 值。 |
Throws | NumberFormatException:
如果 lexicalXSDShort 不是 short 值的有效字符串表示形式。 |
parseShort
public static short parseShort(String lexicalXSDShort)
Converts the string argument into a short value.
- Parameters:
lexicalXSDShort
- A string containing lexical representation of xsd:short.- Returns:
- A short value represented by the string argument.
- Throws:
NumberFormatException
-lexicalXSDShort
is not a valid string representation of ashort
value.
public static java.math.BigDecimal
parseDecimal(String lexicalXSDDecimal)
将字符串参数转换为一个 BigDecimal 值。
lexicalXSDDecimal | 包含 xsd:decimal 的词汇表示形式的字符串。 |
return | 字符串参数表示的 BigDecimal 值。 |
Throws | NumberFormatException:
如果 lexicalXSDDecimal 不是 java.math.BigDecimal 的有效字符串表示形式。 |
parseDecimal
public static BigDecimal parseDecimal(String lexicalXSDDecimal)
Converts the string argument into a BigDecimal value.
- Parameters:
lexicalXSDDecimal
- A string containing lexical representation of xsd:decimal.- Returns:
- A BigDecimal value represented by the string argument.
- Throws:
NumberFormatException
-lexicalXSDDecimal
is not a valid string representation ofBigDecimal
.
public static float
parseFloat(String lexicalXSDFloat)
将字符串参数转换为一个 float 值。
lexicalXSDFloat | 包含 xsd:float 的词汇表示形式的字符串。 |
return | 字符串参数表示的 float 值。 |
Throws | NumberFormatException:
如果 lexicalXSDFloat 不是 float 值的有效字符串表示形式。 |
parseFloat
public static float parseFloat(String lexicalXSDFloat)
Converts the string argument into a float value.
- Parameters:
lexicalXSDFloat
- A string containing lexical representation of xsd:float.- Returns:
- A float value represented by the string argument.
- Throws:
NumberFormatException
-lexicalXSDFloat
is not a valid string representation of afloat
value.
public static double
parseDouble(String lexicalXSDDouble)
将字符串参数转换为一个 double 值。
lexicalXSDDouble | 包含 xsd:double 的词汇表示形式的字符串。 |
return | 字符串参数表示的 double 值。 |
Throws | NumberFormatException:
如果 lexicalXSDDouble 不是 double 值的有效字符串表示形式。 |
parseDouble
public static double parseDouble(String lexicalXSDDouble)
Converts the string argument into a double value.
- Parameters:
lexicalXSDDouble
- A string containing lexical representation of xsd:double.- Returns:
- A double value represented by the string argument.
- Throws:
NumberFormatException
-lexicalXSDDouble
is not a valid string representation of adouble
value.
public static boolean
parseBoolean(String lexicalXSDBoolean)
将字符串参数转换为一个 boolean 值。
lexicalXSDBoolean | 包含 xsd:boolean 的词汇表示形式的字符串。 |
return | 字符串参数表示的 boolean 值。 |
Throws | IllegalArgumentException: 如果字符串参数不符合 XML Schema Part 2: Datatypes 中为 xsd:boolean 定义的词汇值空间。 |
parseBoolean
public static boolean parseBoolean(String lexicalXSDBoolean)
Converts the string argument into a boolean value.
- Parameters:
lexicalXSDBoolean
- A string containing lexical representation of xsd:boolean.- Returns:
- A boolean value represented by the string argument.
- Throws:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:boolean.
public static byte
parseByte(String lexicalXSDByte)
将字符串参数转换为一个 byte 值。
lexicalXSDByte | 包含 xsd:byte 的词汇表示形式的字符串。 |
return | 字符串参数表示的 byte 值。 |
Throws | IllegalArgumentException: 如果字符串参数不符合 XML Schema Part 2: Datatypes 为 xsd:byte 定义的词汇值空间。 |
parseByte
public static byte parseByte(String lexicalXSDByte)
Converts the string argument into a byte value.
- Parameters:
lexicalXSDByte
- A string containing lexical representation of xsd:byte.- Returns:
- A byte value represented by the string argument.
- Throws:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:byte.
public static javax.xml.namespace.QName
parseQName(String lexicalXSDQName, javax.xml.namespace.NamespaceContext nsc)
将字符串参数转换为一个 byte 值。
字符串参数 lexicalXSDQname 必须符合 XML Schema Part 2: Datatypes 规范:QName 中指定的词汇值空间。
lexicalXSDQName | 包含 xsd:QName 的词汇表示形式的字符串。 |
nsc | 解释 QName 中前缀的名称空间上下文。 |
return | 字符串参数表示的 QName 值。 |
Throws | IllegalArgumentException: 如果字符串参数不符合 XML Schema Part 2 规范,或者 lexicalXSDQname 的名称空间前缀未绑定到 NamespaceContext nsc 中的 URI。 |
parseQName
public static QName parseQName(String lexicalXSDQName, NamespaceContext nsc)
Converts the string argument into a byte value.
String parameter lexicalXSDQname must conform to lexical value space specifed at XML Schema Part 2:Datatypes specification:QNames
- 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.
- Throws:
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.
public static java.util.Calendar
parseDateTime(String lexicalXSDDateTime)
将字符串参数转换为一个 Calendar 值。
lexicalXSDDateTime | 包含 xsd:datetime 的词汇表示形式的字符串。 |
return | 字符串参数表示的 Calendar 对象。 |
Throws | IllegalArgumentException: 如果字符串参数不符合 XML Schema Part 2: Datatypes 为 xsd:dateTime 定义的词汇值空间。 |
parseDateTime
public static Calendar parseDateTime(String lexicalXSDDateTime)
Converts the string argument into a Calendar value.
- Parameters:
lexicalXSDDateTime
- A string containing lexical representation of xsd:datetime.- Returns:
- A Calendar object represented by the string argument.
- Throws:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:dateTime.
public static byte[]
parseBase64Binary(String lexicalXSDBase64Binary)
将字符串参数转换为一个字节数组。
lexicalXSDBase64Binary | 包含 xsd:base64Binary 的词汇表示形式的字符串。 |
return | 字符串参数表示的字节数组。 |
Throws | IllegalArgumentException: 如果字符串参数不符合 XML Schema Part 2: Datatypes 为 xsd:base64Binary 定义的词汇值空间。 |
parseBase64Binary
public static byte[] parseBase64Binary(String lexicalXSDBase64Binary)
Converts the string argument into an array of bytes.
- Parameters:
lexicalXSDBase64Binary
- A string containing lexical representation of xsd:base64Binary.- Returns:
- An array of bytes represented by the string argument.
- Throws:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:base64Binary
public static byte[]
parseHexBinary(String lexicalXSDHexBinary)
将字符串参数转换为一个字节数组。
lexicalXSDHexBinary | 包含 xsd:hexBinary 的词汇表示形式的字符串。 |
return | 字符串参数表示的字节数组。 |
Throws | IllegalArgumentException: 如果字符串参数不符合 XML Schema Part 2: Datatypes 为 xsd:hexBinary 定义的词汇值空间。 |
parseHexBinary
public static byte[] parseHexBinary(String lexicalXSDHexBinary)
Converts the string argument into an array of bytes.
- Parameters:
lexicalXSDHexBinary
- A string containing lexical representation of xsd:hexBinary.- Returns:
- An array of bytes represented by the string argument.
- Throws:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:hexBinary.
public static long
parseUnsignedInt(String lexicalXSDUnsignedInt)
将字符串参数转换为一个 long 值。
lexicalXSDUnsignedInt | 包含 xsd:unsignedInt 的词汇表示形式的字符串。 |
return | 字符串参数表示的 long 值。 |
Throws | NumberFormatException: 如果不能将字符串参数解析为 long 值。 |
parseUnsignedInt
public static long parseUnsignedInt(String lexicalXSDUnsignedInt)
Converts the string argument into a long value.
- Parameters:
lexicalXSDUnsignedInt
- A string containing lexical representation of xsd:unsignedInt.- Returns:
- A long value represented by the string argument.
- Throws:
NumberFormatException
- if string parameter can not be parsed into a long value.
public static int
parseUnsignedShort(String lexicalXSDUnsignedShort)
将字符串参数转换为一个 int 值。
lexicalXSDUnsignedShort | 包含 xsd:unsignedShort 的词汇表示形式的字符串。 |
return | 字符串参数表示的 int 值。 |
Throws | NumberFormatException: 如果不能将字符串参数解析为 int 值。 |
parseUnsignedShort
public static int parseUnsignedShort(String lexicalXSDUnsignedShort)
Converts the string argument into an int value.
- Parameters:
lexicalXSDUnsignedShort
- A string containing lexical representation of xsd:unsignedShort.- Returns:
- An int value represented by the string argument.
- Throws:
NumberFormatException
- if string parameter can not be parsed into an int value.
public static java.util.Calendar
parseTime(String lexicalXSDTime)
将字符串参数转换为一个 Calendar 值。
lexicalXSDTime | 包含 xsd:time 的词汇表示形式的字符串。 |
return | 字符串参数表示的 Calendar 值。 |
Throws | IllegalArgumentException: 如果字符串参数不符合 XML Schema Part 2: Datatypes 为 xsd:Time 定义的词汇值空间。 |
parseTime
public static Calendar parseTime(String lexicalXSDTime)
Converts the string argument into a Calendar value.
- Parameters:
lexicalXSDTime
- A string containing lexical representation of xsd:time.- Returns:
- A Calendar value represented by the string argument.
- Throws:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Time.
public static java.util.Calendar
parseDate(String lexicalXSDDate)
将字符串参数转换为一个 Calendar 值。
lexicalXSDDate | 包含 xsd:Date 的词汇表示形式的字符串。 |
return | 字符串参数表示的 Calendar 值。 |
Throws | IllegalArgumentException: 如果字符串参数不符合 XML Schema Part 2: Datatypes 为 xsd:Date 定义的词汇值空间。 |
parseDate
public static Calendar parseDate(String lexicalXSDDate)
Converts the string argument into a Calendar value.
- Parameters:
lexicalXSDDate
- A string containing lexical representation of xsd:Date.- Returns:
- A Calendar value represented by the string argument.
- Throws:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Date.
public static String
parseAnySimpleType(String lexicalXSDAnySimpleType)
返回包含简单类型的词汇表示形式的字符串。
lexicalXSDAnySimpleType | 包含简单类型的词汇表示形式的字符串。 |
return | 包含简单类型的词汇表示形式的字符串。 |
parseAnySimpleType
public static String parseAnySimpleType(String lexicalXSDAnySimpleType)
Return a string containing the lexical representation of the simple type.
- Parameters:
lexicalXSDAnySimpleType
- A string containing lexical representation of the simple type.- Returns:
- A string containing the lexical representation of the simple type.
public static String
printString(String val)
将字符串参数转换为一个字符串。
val | 字符串值。 |
return | 包含 xsd:string 的词汇表示形式的字符串。 |
printString
public static String printString(String val)
Converts the string argument into a string.
- Parameters:
val
- A string value.- Returns:
- A string containing a lexical representation of xsd:string.
public static String
printInteger(java.math.BigInteger val)
将 BigInteger 值转换为一个字符串。
val | 一个 BigInteger 值 |
return | 包含 xsd:integer 的词汇表示形式的字符串 |
Throws | IllegalArgumentException: 如果 val 为 null。 |
printInteger
public static String printInteger(BigInteger val)
Converts a BigInteger value into a string.
- Parameters:
val
- A BigInteger value- Returns:
- A string containing a lexical representation of xsd:integer
- Throws:
IllegalArgumentException
- val is null.
public static String
printInt(int val)
将 int 值转换为一个字符串。
val | 一个 int 值 |
return | 包含 xsd:int 的词汇表示形式的字符串 |
printInt
public static String printInt(int val)
Converts an int value into a string.
- Parameters:
val
- An int value- Returns:
- A string containing a lexical representation of xsd:int
public static String
printLong(long val)
将 long 值转换为一个字符串。
val | 一个 long 值 |
return | 包含 xsd:long 的词汇表示形式的字符串 |
printLong
public static String printLong(long val)
Converts A long value into a string.
- Parameters:
val
- A long value- Returns:
- A string containing a lexical representation of xsd:long
public static String
printShort(short val)
将 short 值转换为一个字符串。
val | 一个 short 值 |
return | 包含 xsd:short 的词汇表示形式的字符串 |
printShort
public static String printShort(short val)
Converts a short value into a string.
- Parameters:
val
- A short value- Returns:
- A string containing a lexical representation of xsd:short
public static String
printDecimal(java.math.BigDecimal val)
将 BigDecimal 值转换为一个字符串。
val | 一个 BigDecimal 值 |
return | 包含 xsd:decimal 的词汇表示形式的字符串 |
Throws | IllegalArgumentException: 如果 val 为 null。 |
printDecimal
public static String printDecimal(BigDecimal val)
Converts a BigDecimal value into a string.
- Parameters:
val
- A BigDecimal value- Returns:
- A string containing a lexical representation of xsd:decimal
- Throws:
IllegalArgumentException
- val is null.
public static String
printFloat(float val)
将 float 值转换为一个字符串。
val | 一个 float 值 |
return | 包含 xsd:float 的词汇表示形式的字符串 |
printFloat
public static String printFloat(float val)
Converts a float value into a string.
- Parameters:
val
- A float value- Returns:
- A string containing a lexical representation of xsd:float
public static String
printDouble(double val)
将 double 值转换为一个字符串。
val | 一个 double 值 |
return | 包含 xsd:double 的词汇表示形式的字符串 |
printDouble
public static String printDouble(double val)
Converts a double value into a string.
- Parameters:
val
- A double value- Returns:
- A string containing a lexical representation of xsd:double
public static String
printBoolean(boolean val)
将 boolean 值转换为一个字符串。
val | 一个 boolean 值 |
return | 包含 xsd:boolean 的词汇表示形式的字符串 |
printBoolean
public static String printBoolean(boolean val)
Converts a boolean value into a string.
- Parameters:
val
- A boolean value- Returns:
- A string containing a lexical representation of xsd:boolean
public static String
printByte(byte val)
将 byte 值转换为一个字符串。
val | 一个 byte 值 |
return | 包含 xsd:byte 的词汇表示形式的字符串 |
printByte
public static String printByte(byte val)
Converts a byte value into a string.
- Parameters:
val
- A byte value- Returns:
- A string containing a lexical representation of xsd:byte
public static String
printQName(javax.xml.namespace.QName val, javax.xml.namespace.NamespaceContext nsc)
将 QName 实例转换为一个字符串。
val | 一个 QName 值 |
nsc | 解释 QName 中前缀的名称空间上下文。 |
return | 包含 QName 的词汇表示形式的字符串 |
Throws | IllegalArgumentException: 如果 val 为 null、nsc 为非 null 或 nsc.getPrefix(nsprefixFromVal) 为 null。 |
printQName
public static String printQName(QName val, NamespaceContext nsc)
Converts a QName instance into a string.
- Parameters:
val
- A QName valuensc
- A namespace context for interpreting a prefix within a QName.- Returns:
- A string containing a lexical representation of QName
- Throws:
IllegalArgumentException
- if val is null or if nsc is non-null or nsc.getPrefix(nsprefixFromVal) is null.
public static String
printDateTime(java.util.Calendar val)
将 Calendar 值转换为一个字符串。
val | 一个 Calendar 值 |
return | 包含 xsd:dateTime 的词汇表示形式的字符串 |
Throws | IllegalArgumentException: 如果 val 为 null。 |
printDateTime
public static String printDateTime(Calendar val)
Converts a Calendar value into a string.
- Parameters:
val
- A Calendar value- Returns:
- A string containing a lexical representation of xsd:dateTime
- Throws:
IllegalArgumentException
- if val is null.
public static String
printBase64Binary(byte[] val)
将字节数组转换为一个字符串。
val | 一个字节数组 |
return | 包含 xsd:base64Binary 的词汇表示形式的字符串 |
Throws | IllegalArgumentException: 如果 val 为 null。 |
printBase64Binary
public static String printBase64Binary(byte[] val)
Converts an array of bytes into a string.
- Parameters:
val
- An array of bytes- Returns:
- A string containing a lexical representation of xsd:base64Binary
- Throws:
IllegalArgumentException
- if val is null.
public static String
printHexBinary(byte[] val)
将字节数组转换为一个字符串。
val | 一个字节数组 |
return | 包含 xsd:hexBinary 的词汇表示形式的字符串 |
Throws | IllegalArgumentException: 如果 val 为 null。 |
printHexBinary
public static String printHexBinary(byte[] val)
Converts an array of bytes into a string.
- Parameters:
val
- An array of bytes- Returns:
- A string containing a lexical representation of xsd:hexBinary
- Throws:
IllegalArgumentException
- if val is null.
public static String
printUnsignedInt(long val)
将 long 值转换为一个字符串。
val | 一个 long 值 |
return | 包含 xsd:unsignedInt 的词汇表示形式的字符串 |
printUnsignedInt
public static String printUnsignedInt(long val)
Converts a long value into a string.
- Parameters:
val
- A long value- Returns:
- A string containing a lexical representation of xsd:unsignedInt
public static String
printUnsignedShort(int val)
将 int 值转换为一个字符串。
val | 一个 int 值 |
return | 包含 xsd:unsignedShort 的词汇表示形式的字符串 |
printUnsignedShort
public static String printUnsignedShort(int val)
Converts an int value into a string.
- Parameters:
val
- An int value- Returns:
- A string containing a lexical representation of xsd:unsignedShort
public static String
printTime(java.util.Calendar val)
将 Calendar 值转换为一个字符串。
val | 一个 Calendar 值 |
return | 包含 xsd:time 的词汇表示形式的字符串 |
Throws | IllegalArgumentException: 如果 val 为 null。 |
printTime
public static String printTime(Calendar val)
Converts a Calendar value into a string.
- Parameters:
val
- A Calendar value- Returns:
- A string containing a lexical representation of xsd:time
- Throws:
IllegalArgumentException
- if val is null.
public static String
printDate(java.util.Calendar val)
将 Calendar 值转换为一个字符串。
val | 一个 Calendar 值 |
return | 包含 xsd:date 的词汇表示形式的字符串 |
Throws | IllegalArgumentException: 如果 val 为 null。 |
printDate
public static String printDate(Calendar val)
Converts a Calendar value into a string.
- Parameters:
val
- A Calendar value- Returns:
- A string containing a lexical representation of xsd:date
- Throws:
IllegalArgumentException
- if val is null.
public static String
printAnySimpleType(String val)
将字符串值转换为一个字符串。
val | 字符串值 |
return | 包含 xsd:AnySimpleType 的词汇表示形式的字符串 |
printAnySimpleType
public static String printAnySimpleType(String val)
Converts a string value into a string.
- Parameters:
val
- A string value- Returns:
- A string containing a lexical representation of xsd:AnySimpleType
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!