Class ConstructorInstantiator

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

public class ConstructorInstantiator extends Object implements Instantiator
An instantiator used for record types which passes in all necessary fields
  • Method Details

    • createDefault

      public static <T> Instantiator createDefault(Class<?> clazz)
      Attempts to create an Instantiator for a record type, or a class which has a constructor taking all its fields in the same order they appear in the class
      Type Parameters:
      T - The type
      Parameters:
      clazz - The class to create an Instantiator for
      Returns:
      An Instantiator
    • instantiate

      public <T> T instantiate(ConversionManager manager, Object target, Class<T> clazz, List<Object> values, String path, FieldSummary info)
      Instantiates a new object using its constructor
      Specified by:
      instantiate in interface Instantiator
      Type Parameters:
      T - The type
      Parameters:
      manager - The ConversionManager handling converters
      target - The target object, always ignored by this type of Instantiator
      clazz - The class whose fields are being used
      values - The values for the fields
      path - The path in config
      info - Extra info about the instantiation
      Returns:
      The constructed object