|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
javax.xml.bind Interface DatatypeConverterInterface
public interface DatatypeConverterInterface
The DatatypeConverterInterface is for JAXB provider use only. A
JAXB provider must supply a class that implements this interface.
JAXB Providers are required to call the
DatatypeConverter.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. Calling this api repeatedly will have no effect - the
DatatypeConverter instance passed into the first invocation is the one that
will be used from then on.
This interface defines the parse and print methods. There is one parse and print method for each XML schema datatype specified in the the default binding Table 5-1 in the JAXB specification.
The parse and print methods defined here are invoked by the static parse
and print methods defined in the DatatypeConverter
class.
A parse method for a XML schema datatype must be capable of converting any lexical representation of the XML schema datatype ( specified by the XML Schema Part2: Datatypes specification into a value in the value space of 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.
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.
The prefix xsd: is used to refer to XML schema datatypes XML Schema Part2: Datatypes specification.
- 从以下版本开始:
- JAXB1.0
- 版本:
- $Revision: 1.5 $
- 作者:
- Sekhar Vajjhala, Sun Microsystems, Inc.
- Joe Fialli, Sun Microsystems Inc.
- Kohsuke Kawaguchi, Sun Microsystems, Inc.
- Ryan Shoemaker,Sun Microsystems Inc.
- 另请参见:
DatatypeConverter
,ParseConversionEvent
,PrintConversionEvent
方法摘要 | |
---|---|
String |
parseAnySimpleType(String lexicalXSDAnySimpleType)
Return a string containing the lexical representation of the simple type. |
byte[] |
parseBase64Binary(String lexicalXSDBase64Binary)
Converts the string argument into an array of bytes. |
boolean |
parseBoolean(String lexicalXSDBoolean)
Converts the string argument into a boolean value. |
byte |
parseByte(String lexicalXSDByte)
Converts the string argument into a byte value. |
Calendar |
parseDate(String lexicalXSDDate)
Converts the string argument into a Calendar value. |
Calendar |
parseDateTime(String lexicalXSDDateTime)
Converts the string argument into a Calendar value. |
BigDecimal |
parseDecimal(String lexicalXSDDecimal)
Converts the string argument into a BigDecimal value. |
double |
parseDouble(String lexicalXSDDouble)
Converts the string argument into a double value. |
float |
parseFloat(String lexicalXSDFloat)
Converts the string argument into a float value. |
byte[] |
parseHexBinary(String lexicalXSDHexBinary)
Converts the string argument into an array of bytes. |
int |
parseInt(String lexicalXSDInt)
Convert the string argument into an int value. |
BigInteger |
parseInteger(String lexicalXSDInteger)
Convert the string argument into a BigInteger value. |
long |
parseLong(String lexicalXSDLong)
Converts the string argument into a long value. |
QName |
parseQName(String lexicalXSDQName,
NamespaceContext nsc)
Converts the string argument into a QName value. |
short |
parseShort(String lexicalXSDShort)
Converts the string argument into a short value. |
String |
parseString(String lexicalXSDString)
Convert the string argument into a string. |
Calendar |
parseTime(String lexicalXSDTime)
Converts the string argument into a Calendar value. |
long |
parseUnsignedInt(String lexicalXSDUnsignedInt)
Converts the string argument into a long value. |
int |
parseUnsignedShort(String lexicalXSDUnsignedShort)
Converts the string argument into an int value. |
String |
printAnySimpleType(String val)
Converts a string value into a string. |
String |
printBase64Binary(byte[] val)
Converts an array of bytes into a string. |
String |
printBoolean(boolean val)
Converts a boolean value into a string. |
String |
printByte(byte val)
Converts a byte value into a string. |
String |
printDate(Calendar val)
Converts a Calendar value into a string. |
String |
printDateTime(Calendar val)
Converts a Calendar value into a string. |
String |
printDecimal(BigDecimal val)
Converts a BigDecimal value into a string. |
String |
printDouble(double val)
Converts a double value into a string. |
String |
printFloat(float val)
Converts a float value into a string. |
String |
printHexBinary(byte[] val)
Converts an array of bytes into a string. |
String |
printInt(int val)
Converts an int value into a string. |
String |
printInteger(BigInteger val)
Converts a BigInteger value into a string. |
String |
printLong(long val)
Converts a long value into a string. |
String |
printQName(QName val,
NamespaceContext nsc)
Converts a QName instance into a string. |
String |
printShort(short val)
Converts a short value into a string. |
String |
printString(String val)
Converts the string argument into a string. |
String |
printTime(Calendar val)
Converts a Calendar value into a string. |
String |
printUnsignedInt(long val)
Converts a long value into a string. |
String |
printUnsignedShort(int val)
Converts an int value into a string. |
方法详细信息 |
---|
parseString
String parseString(String lexicalXSDString)
Convert the string argument into a string.
- 参数:
lexicalXSDString
- A lexical representation of the XML Schema datatype xsd:string- 返回:
- A string that is the same as the input string.
parseInteger
BigInteger parseInteger(String lexicalXSDInteger)
Convert the string argument into a BigInteger value.
- 参数:
lexicalXSDInteger
- A string containing a lexical representation of xsd:integer.- 返回:
- A BigInteger value represented by the string argument.
- 抛出异常:
NumberFormatException
-lexicalXSDInteger
is not a valid string representation of aBigInteger
value.
parseInt
int parseInt(String lexicalXSDInt)
Convert the string argument into an int value.
- 参数:
lexicalXSDInt
- A string containing a lexical representation of xsd:int.- 返回:
- An int value represented byte the string argument.
- 抛出异常:
NumberFormatException
-lexicalXSDInt
is not a valid string representation of anint
value.
parseLong
long parseLong(String lexicalXSDLong)
Converts the string argument into a long value.
- 参数:
lexicalXSDLong
- A string containing lexical representation of xsd:long.- 返回:
- A long value represented by the string argument.
- 抛出异常:
NumberFormatException
-lexicalXSDLong
is not a valid string representation of along
value.
parseShort
short parseShort(String lexicalXSDShort)
Converts the string argument into a short value.
- 参数:
lexicalXSDShort
- A string containing lexical representation of xsd:short.- 返回:
- A short value represented by the string argument.
- 抛出异常:
NumberFormatException
-lexicalXSDShort
is not a valid string representation of ashort
value.
parseDecimal
BigDecimal parseDecimal(String lexicalXSDDecimal)
Converts the string argument into a BigDecimal value.
- 参数:
lexicalXSDDecimal
- A string containing lexical representation of xsd:decimal.- 返回:
- A BigDecimal value represented by the string argument.
- 抛出异常:
NumberFormatException
-lexicalXSDDecimal
is not a valid string representation ofBigDecimal
.
parseFloat
float parseFloat(String lexicalXSDFloat)
Converts the string argument into a float value.
- 参数:
lexicalXSDFloat
- A string containing lexical representation of xsd:float.- 返回:
- A float value represented by the string argument.
- 抛出异常:
NumberFormatException
-lexicalXSDFloat
is not a valid string representation of afloat
value.
parseDouble
double parseDouble(String lexicalXSDDouble)
Converts the string argument into a double value.
- 参数:
lexicalXSDDouble
- A string containing lexical representation of xsd:double.- 返回:
- A double value represented by the string argument.
- 抛出异常:
NumberFormatException
-lexicalXSDDouble
is not a valid string representation of adouble
value.
parseBoolean
boolean parseBoolean(String lexicalXSDBoolean)
Converts the string argument into a boolean value.
- 参数:
lexicalXSDBoolean
- A string containing lexical representation of xsd:boolean.- 返回:
- A boolean value represented by the string argument.
- 抛出异常:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:boolean.
parseByte
byte parseByte(String lexicalXSDByte)
Converts the string argument into a byte value.
- 参数:
lexicalXSDByte
- A string containing lexical representation of xsd:byte.- 返回:
- A byte value represented by the string argument.
- 抛出异常:
NumberFormatException
-lexicalXSDByte
does not contain a parseable byte.IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:byte.
parseQName
QName parseQName(String lexicalXSDQName, NamespaceContext nsc)
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
- 参数:
lexicalXSDQName
- A string containing lexical representation of xsd:QName.nsc
- A namespace context for interpreting a prefix within a QName.- 返回:
- A QName value represented by the string argument.
- 抛出异常:
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.
parseDateTime
Calendar parseDateTime(String lexicalXSDDateTime)
Converts the string argument into a Calendar value.
- 参数:
lexicalXSDDateTime
- A string containing lexical representation of xsd:datetime.- 返回:
- A Calendar object represented by the string argument.
- 抛出异常:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:dateTime.
parseBase64Binary
byte[] parseBase64Binary(String lexicalXSDBase64Binary)
Converts the string argument into an array of bytes.
- 参数:
lexicalXSDBase64Binary
- A string containing lexical representation of xsd:base64Binary.- 返回:
- An array of bytes represented by the string argument.
- 抛出异常:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:base64Binary
parseHexBinary
byte[] parseHexBinary(String lexicalXSDHexBinary)
Converts the string argument into an array of bytes.
- 参数:
lexicalXSDHexBinary
- A string containing lexical representation of xsd:hexBinary.- 返回:
- An array of bytes represented by the string argument.
- 抛出异常:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:hexBinary.
parseUnsignedInt
long parseUnsignedInt(String lexicalXSDUnsignedInt)
Converts the string argument into a long value.
- 参数:
lexicalXSDUnsignedInt
- A string containing lexical representation of xsd:unsignedInt.- 返回:
- A long value represented by the string argument.
- 抛出异常:
NumberFormatException
- if string parameter can not be parsed into a long value.
parseUnsignedShort
int parseUnsignedShort(String lexicalXSDUnsignedShort)
Converts the string argument into an int value.
- 参数:
lexicalXSDUnsignedShort
- A string containing lexical representation of xsd:unsignedShort.- 返回:
- An int value represented by the string argument.
- 抛出异常:
NumberFormatException
- if string parameter can not be parsed into an int value.
parseTime
Calendar parseTime(String lexicalXSDTime)
Converts the string argument into a Calendar value.
- 参数:
lexicalXSDTime
- A string containing lexical representation of xsd:Time.- 返回:
- A Calendar value represented by the string argument.
- 抛出异常:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Time.
parseDate
Calendar parseDate(String lexicalXSDDate)
Converts the string argument into a Calendar value.
- 参数:
lexicalXSDDate
- A string containing lexical representation of xsd:Date.- 返回:
- A Calendar value represented by the string argument.
- 抛出异常:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Date.
parseAnySimpleType
String parseAnySimpleType(String lexicalXSDAnySimpleType)
Return a string containing the lexical representation of the simple type.
- 参数:
lexicalXSDAnySimpleType
- A string containing lexical representation of the simple type.- 返回:
- A string containing the lexical representation of the simple type.
printString
String printString(String val)
Converts the string argument into a string.
- 参数:
val
- A string value.- 返回:
- A string containing a lexical representation of xsd:string
printInteger
String printInteger(BigInteger val)
Converts a BigInteger value into a string.
- 参数:
val
- A BigInteger value- 返回:
- A string containing a lexical representation of xsd:integer
- 抛出异常:
IllegalArgumentException
- val is null.
printInt
String printInt(int val)
Converts an int value into a string.
- 参数:
val
- An int value- 返回:
- A string containing a lexical representation of xsd:int
printLong
String printLong(long val)
Converts a long value into a string.
- 参数:
val
- A long value- 返回:
- A string containing a lexical representation of xsd:long
printShort
String printShort(short val)
Converts a short value into a string.
- 参数:
val
- A short value- 返回:
- A string containing a lexical representation of xsd:short
printDecimal
String printDecimal(BigDecimal val)
Converts a BigDecimal value into a string.
- 参数:
val
- A BigDecimal value- 返回:
- A string containing a lexical representation of xsd:decimal
- 抛出异常:
IllegalArgumentException
- val is null.
printFloat
String printFloat(float val)
Converts a float value into a string.
- 参数:
val
- A float value- 返回:
- A string containing a lexical representation of xsd:float
printDouble
String printDouble(double val)
Converts a double value into a string.
- 参数:
val
- A double value- 返回:
- A string containing a lexical representation of xsd:double
printBoolean
String printBoolean(boolean val)
Converts a boolean value into a string.
- 参数:
val
- A boolean value- 返回:
- A string containing a lexical representation of xsd:boolean
printByte
String printByte(byte val)
Converts a byte value into a string.
- 参数:
val
- A byte value- 返回:
- A string containing a lexical representation of xsd:byte
printQName
String printQName(QName val, NamespaceContext nsc)
Converts a QName instance into a string.
- 参数:
val
- A QName valuensc
- A namespace context for interpreting a prefix within a QName.- 返回:
- A string containing a lexical representation of QName
- 抛出异常:
IllegalArgumentException
- if val is null or if nsc is non-null or nsc.getPrefix(nsprefixFromVal) is null.
printDateTime
String printDateTime(Calendar val)
Converts a Calendar value into a string.
- 参数:
val
- A Calendar value- 返回:
- A string containing a lexical representation of xsd:dateTime
- 抛出异常:
IllegalArgumentException
- if val is null.
printBase64Binary
String printBase64Binary(byte[] val)
Converts an array of bytes into a string.
- 参数:
val
- an array of bytes- 返回:
- A string containing a lexical representation of xsd:base64Binary
- 抛出异常:
IllegalArgumentException
- if val is null.
printHexBinary
String printHexBinary(byte[] val)
Converts an array of bytes into a string.
- 参数:
val
- an array of bytes- 返回:
- A string containing a lexical representation of xsd:hexBinary
- 抛出异常:
IllegalArgumentException
- if val is null.
printUnsignedInt
String printUnsignedInt(long val)
Converts a long value into a string.
- 参数:
val
- A long value- 返回:
- A string containing a lexical representation of xsd:unsignedInt
printUnsignedShort
String printUnsignedShort(int val)
Converts an int value into a string.
- 参数:
val
- An int value- 返回:
- A string containing a lexical representation of xsd:unsignedShort
printTime
String printTime(Calendar val)
Converts a Calendar value into a string.
- 参数:
val
- A Calendar value- 返回:
- A string containing a lexical representation of xsd:time
- 抛出异常:
IllegalArgumentException
- if val is null.
printDate
String printDate(Calendar val)
Converts a Calendar value into a string.
- 参数:
val
- A Calendar value- 返回:
- A string containing a lexical representation of xsd:date
- 抛出异常:
IllegalArgumentException
- if val is null.
printAnySimpleType
String printAnySimpleType(String val)
Converts a string value into a string.
- 参数:
val
- A string value- 返回:
- A string containing a lexical representation of xsd:AnySimpleType
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.