Top Description Fields Methods
com.sun.msv.datatype

public Interface DatabindableDatatype

extends Datatype
Known Direct Subinterfaces
com.sun.msv.datatype.xsd.XSDatatype
Imports
org.relaxng.datatype.Datatype, .ValidationContext

Datatype interface that supports Java databinding. This interface can be used to do java/xml databinding.
Author
Kohsuke Kawaguchi

Field Summary

Inherited from org.relaxng.datatype.Datatype:
ID_TYPE_IDID_TYPE_IDREFID_TYPE_IDREFSID_TYPE_NULL

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

null when the given lexical value is not a valid lexical value for this type.
createJavaObject
(String literal, ValidationContext context)

converts lexcial value to a corresponding Java-friendly object by using the given context information.

public Class<T>
getJavaObjectType()

gets the type of the objects that are created by the createJavaObject method.

public String

Returns:

null if the given object is invalid with respect to this datatype.
serializeJavaObject
(Object value, SerializationContext
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.
context
)

converts a value object back to the lexical representation.

Inherited from org.relaxng.datatype.Datatype:
checkValidcreateStreamingValidatorcreateValuegetIdTypeisContextDependentisValidsameValuevalueHashCode

Method Detail

createJavaObjectback to summary
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.

Returns:Object

null when the given lexical value is not a valid lexical value for this type.

getJavaObjectTypeback to summary
public Class<T> getJavaObjectType()

gets the type of the objects that are created by the createJavaObject method.

serializeJavaObjectback to summary
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.

Parameters
context:SerializationContext

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.

Returns:String

null if the given object is invalid with respect to this datatype.

Exceptions
IllegalArgumentException:
If the type of the specified value object is not recognized, this exception is thrown. For example, if you pass a String object to the serializeJavaObject method of the "positiveInteger" type, this exception is thrown.