simple.xml.load
Interface Type


public interface Type

The 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.

Author:
Niall Gallagher
See Also:
Strategy

Method Summary
 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.
 

Method Detail

isReference

boolean isReference()
This is used to determine if the type is a reference type. A reference type is a type that does not require any XML deserialization based on its annotations. Types that are references could be substitutes objects are existing ones.

Returns:
this returns true if the object is a reference

getInstance

java.lang.Object getInstance()
                             throws java.lang.Exception
This method is used to acquire an instance of the type that is defined by this object. If for some reason the type can not be instantiated an exception is thrown from this.

Returns:
an instance of the type this object represents
Throws:
java.lang.Exception

getInstance

java.lang.Object getInstance(java.lang.Class convert)
                             throws java.lang.Exception
This method is used to acquire an instance of the type that is defined by this object. If for some reason the type can not be instantiated an exception is thrown from this.

Parameters:
convert - a suggestion to convert the internal value
Returns:
an instance of the type this object represents
Throws:
java.lang.Exception

getType

java.lang.Class getType()
This is the type of the object instance that will be created by the getInstance method. This allows the deserialization process to perform checks against the field.

Returns:
the type of the object that will be instantiated