Class 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 be List<String> (but value type will remain ArrayList<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.setup.Bootstrap bootstrap, io.dropwizard.Configuration configuration)
      Shortcut for build(Bootstrap, Configuration, boolean) with enabled introspection.
      static ConfigurationTree build​(io.dropwizard.setup.Bootstrap bootstrap, io.dropwizard.Configuration configuration, boolean introspect)
      Analyze configuration object to extract bindable parts.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • build

        public static ConfigurationTree build​(io.dropwizard.setup.Bootstrap bootstrap,
                                              io.dropwizard.Configuration configuration)
        Shortcut for build(Bootstrap, Configuration, boolean) with enabled introspection.
        Parameters:
        bootstrap - bootstrap instance
        configuration - configuration instance
        Returns:
        parsed configuration info
      • build

        public static ConfigurationTree build​(io.dropwizard.setup.Bootstrap bootstrap,
                                              io.dropwizard.Configuration configuration,
                                              boolean introspect)
        Analyze configuration object to extract bindable parts.
        Parameters:
        bootstrap - bootstrap instance
        configuration - configuration instance
        introspect - true to introspect configuration object and extract values by path and unique sub configurations
        Returns:
        parsed configuration info