Class EmptyInstantiator

java.lang.Object
redempt.redlib.config.instantiation.EmptyInstantiator
All Implemented Interfaces:
Instantiator

public class EmptyInstantiator extends Object implements Instantiator
An Instantiator which uses an empty constructor, then populates fields and invokes a post-init method
  • Constructor Details

    • EmptyInstantiator

      public EmptyInstantiator()
  • Method Details

    • instantiate

      public static <T> T instantiate(Class<T> clazz)
      Creates an instance of a class if it has a no-args constructor
      Type Parameters:
      T - The type of the class
      Parameters:
      clazz - The class to instantiate
      Returns:
      The instance
    • instantiate

      public <T> T instantiate(ConversionManager manager, Object target, Class<T> clazz, List<Object> values, String path, FieldSummary info)
      Instantiates an object, loads values into its fields, and calls the post-init method
      Specified by:
      instantiate in interface Instantiator
      Type Parameters:
      T - The type
      Parameters:
      manager - The ConversionManager handling converters
      target - The object to load to, or null if creating a new one
      clazz - The class whose fields are being worked with
      values - The values for the fields
      path - The path in config
      info - Extra info used for post-instantiation steps
      Returns:
      The instantiated object, or the input object with its fields modified