Config.
See create(Config, Class).
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static < the type of the class to be instantiated T> T |
| ConfigBeanFactory | back to summary |
|---|---|
| public ConfigBeanFactory() | |
| create | back to summary |
|---|---|
| public static <T> T create(Config config, Class<T> clazz) Creates an instance of a class, initializing its fields from a
Config configSource = ConfigFactory.load().getConfig("foo");
FooConfig config = ConfigBeanFactory.create(configSource, FooConfig.class);
The Java class should follow JavaBean conventions. Field types
can be any of the types you can normally get from a Config, including java.time.Duration or ConfigMemorySize. Fields may also be another JavaBean-style
class.
Fields are mapped to config by converting the config key to
camel case. So the key foo-bar becomes JavaBean
setter setFooBar.
| |