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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.List<Creator> getCreators()
      This is used to acquire the Creator objects used to create an instance of the object.
      java.lang.Object getInstance()
      This is used to instantiate the object using the default no argument constructor.
      java.lang.Object getInstance​(Criteria criteria)
      This is used to instantiate the object using a constructor that takes deserialized objects as arguments.
      Parameter getParameter​(java.lang.String name)
      This is used to acquire the named Parameter from the creator.
      java.util.List<Parameter> getParameters()
      This is used to acquire all parameters annotated for the class schema.
      boolean isDefault()
      This is used to determine if this Instantiator has a default constructor.
    • Method Detail

      • 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

        java.lang.Object getInstance()
                              throws java.lang.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:
        java.lang.Exception
      • getInstance

        java.lang.Object getInstance​(Criteria criteria)
                              throws java.lang.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:
        java.lang.Exception
      • getParameter

        Parameter getParameter​(java.lang.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

        java.util.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

        java.util.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