public interface Type
Type
object describes a type that is represented
by an XML element. This enables a Strategy
to define
not only the type an element represents, but also defines how that
type can be created. This allows objects that do not have default
no argument constructors to be created during deserialization.
Typically the getInstance
method acts as a proxy to
the classes new instance method, which takes no arguments. Simply
delegating to Class.newInstance
will sometimes not
be sufficient, is such cases reflectively acquiring the classes
constructor may be required in order to pass arguments.
Strategy
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getInstance()
This method is used to acquire an instance of the type that
is defined by this object.
|
java.lang.Object |
getInstance(java.lang.Class convert)
This method is used to acquire an instance of the type that
is defined by this object.
|
java.lang.Class |
getType()
This is the type of the object instance that will be created
by the
getInstance method. |
boolean |
isReference()
This is used to determine if the type is a reference type.
|
boolean isReference()
java.lang.Object getInstance() throws java.lang.Exception
java.lang.Exception
java.lang.Object getInstance(java.lang.Class convert) throws java.lang.Exception
convert
- a suggestion to convert the internal valuejava.lang.Exception
java.lang.Class getType()
getInstance
method. This allows the
deserialization process to perform checks against the field.