Package org.simpleframework.xml.core
Interface Creator
- All Known Implementing Classes:
SignatureCreator
interface Creator
The
Instantiator object is used to represent an single
constructor within an object. It contains the actual constructor
as well as the list of parameters. Each instantiator will score its
weight when given a Criteria object. This allows
the deserialization process to find the most suitable one to
use when instantiating an object.-
Method Summary
Modifier and TypeMethodDescriptionThis is used to instantiate the object using the default no argument constructor.getInstance(Criteria criteria) This is used to instantiate the object using a constructor that takes deserialized objects as arguments.doubleThis is used to score thisInstantiatorobject so that it can be weighed amongst other constructors.This is the signature associated with the creator.getType()This is the type associated with theCreatorobject.
-
Method Details
-
getInstance
This is used to instantiate the object using the default no argument constructor. If for some reason the object can not be instantiated then this will throw an exception with the reason.- Returns:
- this returns the object that has been instantiated
- Throws:
Exception
-
getInstance
This is used to instantiate the object using a constructor that takes deserialized objects as arguments. The object that have been deserialized can be taken from theCriteriaobject which contains the deserialized values.- Parameters:
criteria- this contains the criteria to be used- Returns:
- this returns the object that has been instantiated
- Throws:
Exception
-
getScore
This is used to score thisInstantiatorobject so that it can be weighed amongst other constructors. The instantiator that scores the highest is the one that is used for insIntantiation.If any read only element or attribute is not a parameter in the constructor then the constructor is discounted. This is because there is no way to set the read only entity without a constructor injection in to the instantiated object.
- Parameters:
criteria- this contains the criteria to be used- Returns:
- this returns the score based on the criteria provided
- Throws:
Exception
-
getSignature
This is the signature associated with the creator. The signature contains all the parameters associated with the creator as well as the constructor that this represents. Exposing the signature allows the creator to be validated.- Returns:
- this is the signature associated with the creator
- Throws:
Exception
-
getType
This is the type associated with theCreatorobject. All instances returned from this creator will be of this type.- Returns:
- this returns the type associated with this creator
- Throws:
Exception
-