Class ConfigTreeBuilder
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.module.yaml.ConfigTreeBuilder
-
public final class ConfigTreeBuilder extends java.lang.Object
Analyzes configuration instance, prepared by dropwizard, in order to be able to use configuration values directly (e.g. by path).Use jackson serialization api for configuration introspection. This way everything that is accessible for jackson serialization will be extracted. Jackson will perform all required reflection work and cache it during configuration mapping, so performance should not be harmed at all.
Extra generics information is extracted with
GenericsResolver
to use all possibly available types information in bindings.To prevent too deep paths:
- Object in java, groovy or guava packages are not introspected deeper
- Stop on implementations of Iterable, Optional, Duration and Size
Common collection types are projected to base interfaces. E.g. even if property declaration would be
ArrayList<String>
, binding declaration would beList<String>
(but value type will remainArrayList<String>
even if no value available).- Since:
- 04.05.2018
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ConfigurationTree
build(io.dropwizard.core.setup.Bootstrap bootstrap, io.dropwizard.core.Configuration configuration)
Shortcut forbuild(Bootstrap, Configuration, boolean)
with enabled introspection.static ConfigurationTree
build(io.dropwizard.core.setup.Bootstrap bootstrap, io.dropwizard.core.Configuration configuration, boolean introspect)
Analyze configuration object to extract bindable parts.
-
-
-
Method Detail
-
build
public static ConfigurationTree build(io.dropwizard.core.setup.Bootstrap bootstrap, io.dropwizard.core.Configuration configuration)
Shortcut forbuild(Bootstrap, Configuration, boolean)
with enabled introspection.- Parameters:
bootstrap
- bootstrap instanceconfiguration
- configuration instance- Returns:
- parsed configuration info
-
build
public static ConfigurationTree build(io.dropwizard.core.setup.Bootstrap bootstrap, io.dropwizard.core.Configuration configuration, boolean introspect)
Analyze configuration object to extract bindable parts.- Parameters:
bootstrap
- bootstrap instanceconfiguration
- configuration instanceintrospect
- true to introspect configuration object and extract values by path and unique sub configurations- Returns:
- parsed configuration info
-
-