com.sun.msv.datatype
Interface DatabindableDatatype
- Datatype
- XSDatatype
- AnyURIType, Base64BinaryType, BooleanType, BuiltinAtomicType, ByteType, ConcreteType, DataTypeWithFacet, DateTimeType, DateType, DoubleType, DurationType, EntityType, EnumerationFacet, ErrorType, FinalComponent, FloatType, FractionDigitsFacet, GDayType, GMonthDayType, GMonthType, GYearMonthType, GYearType, HexBinaryType, IDREFType, IDType, IntegerType, IntType, LanguageType, LengthFacet, ListType, LongType, MaxExclusiveFacet, MaxInclusiveFacet, MaxLengthFacet, MinExclusiveFacet, MinInclusiveFacet, MinLengthFacet, NameType, NcnameType, NegativeIntegerType, NmtokenType, NonNegativeIntegerType, NonPositiveIntegerType, NormalizedStringType, NumberType, PatternFacet, PositiveIntegerType, Proxy, QnameType, RangeFacet, ShortType, SimpleURType, StringType, TimeType, TokenType, TotalDigitsFacet, UnionType, UnsignedByteType, UnsignedIntType, UnsignedLongType, UnsignedShortType, WhiteSpaceFacet, XSDatatypeImpl
public interface DatabindableDatatype
extends Datatype
Datatype interface that supports Java databinding.
This interface can be used to do java/xml databinding.
Object | createJavaObject(String literal, ValidationContext context) - converts lexcial value to a corresponding Java-friendly object
by using the given context information.
|
Class | getJavaObjectType() - gets the type of the objects that are created by the createJavaObject method.
|
String | serializeJavaObject(Object value, SerializationContext context) - converts a value object back to the lexical representation.
|
createJavaObject
public Object createJavaObject(String literal,
ValidationContext context)
converts lexcial value to a corresponding Java-friendly object
by using the given context information.
For the actual types returned by each type,
see
here.
Note that due to the difference between those Java friendly types
and actual XML Schema specification, the returned object sometimes
loses accuracy. For example, the "time" type allows "0.0000000000001 sec"
which cannot be represented in
java.util.Calendar
class.
- null
when the given lexical value is not a valid lexical value for this type.
getJavaObjectType
public Class getJavaObjectType()
gets the type of the objects that are created by the createJavaObject method.
serializeJavaObject
public String serializeJavaObject(Object value,
SerializationContext context)
throws IllegalArgumentException
converts a value object back to the lexical representation.
This method is a kind of the "reverse" function of the createJavaObject method.
context
- The context object is used to obtain information necessary to
serialize the value object. For example, QName type uses the context
to encode the URI into a prefix.
- null
if the given object is invalid with respect to this datatype.