Interface Instantiator

All Known Implementing Classes:
ClassInstantiator

interface Instantiator
The Instantiator object is used for instantiating objects using either the default no argument constructor or one that takes deserialized values as parameters. This also exposes the parameters and constructors used to instantiate the object.
  • Method Summary

    Modifier and Type
    Method
    Description
    This is used to acquire the Creator objects used to create an instance of the object.
    This is used to instantiate the object using the default no argument constructor.
    This is used to instantiate the object using a constructor that takes deserialized objects as arguments.
    This is used to acquire the named Parameter from the creator.
    This is used to acquire all parameters annotated for the class schema.
    boolean
    This is used to determine if this Instantiator has a default constructor.
  • Method Details

    • isDefault

      boolean isDefault()
      This is used to determine if this Instantiator has a default constructor. If the only constructor this contains is a default no argument constructor this returns true.
      Returns:
      true if the class only has a default constructor
    • getInstance

      Object getInstance() throws Exception
      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

      Object getInstance(Criteria criteria) throws Exception
      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 the Criteria object 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
    • getParameter

      Parameter getParameter(String name)
      This is used to acquire the named Parameter from the creator. A parameter is taken from the constructor which contains annotations for each object that is required. These parameters must have a matching field or method.
      Parameters:
      name - this is the name of the parameter to be acquired
      Returns:
      this returns the named parameter for the creator
    • getParameters

      List<Parameter> getParameters()
      This is used to acquire all parameters annotated for the class schema. Providing all parameters ensures that they can be validated against the annotated methods and fields to ensure that each parameter is valid and has a corresponding match.
      Returns:
      this returns the parameters declared in the schema
    • getCreators

      List<Creator> getCreators()
      This is used to acquire the Creator objects used to create an instance of the object. Each represents a constructor and contains the parameters to the constructor. This is primarily used to validate each constructor against the fields and methods annotated to ensure they are compatible.
      Returns:
      this returns a list of creators for the type