Class EmptyInstantiator
java.lang.Object
redempt.redlib.config.instantiation.EmptyInstantiator
- All Implemented Interfaces:
Instantiator
An Instantiator which uses an empty constructor, then populates fields and invokes a post-init method
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
instantiate
(Class<T> clazz) Creates an instance of a class if it has a no-args constructor<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
-
Constructor Details
-
EmptyInstantiator
public EmptyInstantiator()
-
-
Method Details
-
instantiate
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 interfaceInstantiator
- Type Parameters:
T
- The type- Parameters:
manager
- The ConversionManager handling converterstarget
- The object to load to, or null if creating a new oneclazz
- The class whose fields are being worked withvalues
- The values for the fieldspath
- The path in configinfo
- Extra info used for post-instantiation steps- Returns:
- The instantiated object, or the input object with its fields modified
-