Class ConfigTreeBuilder
java.lang.Object
ru.vyarus.dropwizard.guice.module.yaml.ConfigTreeBuilder
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 be List<String> (but value type will remain
ArrayList<String> even if no value available).
- Since:
- 04.05.2018
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConfigurationTreebuild(io.dropwizard.core.setup.Bootstrap bootstrap, io.dropwizard.core.Configuration configuration) Shortcut forbuild(Bootstrap, Configuration, boolean)with enabled introspection.static ConfigurationTreebuild(io.dropwizard.core.setup.Bootstrap bootstrap, io.dropwizard.core.Configuration configuration, boolean introspect) Analyze configuration object to extract bindable parts.
-
Method Details
-
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
-