fromProperties
Parses a configuration namespace into a data class.
The data class must have at least one constructor which accepts only String or data class instances as its parameters.
This method will select a constructor to parse the configuration according to the following heuristic:
If the class only has one constructor matching the above constraint, that one will be picked.
If there are more than one constructor, the class will prefer to use the primary constructor.
Otherwise, an exception will be thrown.
Fields declared in the primary constructor can optionally be prefixed by an underscore (_
) to facilitate data member hiding.
This method is also capable of parsing properties nested within namespaces, such as parent.child.prop=value
using nested data classes.
If the class or constructor argument name does not match the property name, use Prefix to override the property name.
Parameters
Data class type.
Properties instance to parse from.
If not null, parent object to retrieve default values from.
Throws
if T does not satisfy the requirements of using this method.
Parses a configuration namespace into a data class.
Parameters
Data class type.
Properties instance to parse from.
If not null, parent object to retrieve default values from.
Throws
if clazz does not satisfy the requirements of using this method. In particular:
Parses a configuration namespace into a data class.
Parameters
Data class type.
Properties instance to parse from.
If not null, parent object to retrieve default values from.
Prefix of the configuration namespace.
Throws
if clazz does not satisfy the requirements of using this method. In particular: