Class TigerConfigurationLoader


  • public class TigerConfigurationLoader
    extends Object
    • Constructor Detail

      • TigerConfigurationLoader

        public TigerConfigurationLoader()
    • Method Detail

      • reset

        public void reset()
      • initialize

        public void initialize()
      • instantiateConfigurationBean

        public <T> Optional<T> instantiateConfigurationBean​(Class<T> configurationBeanClass,
                                                            String... baseKeys)
        Instantiates a bean of the given class. The base-keys denote the point from which the keys are taken. If values can not be substituted (e.g. ${key.that.does.not.exist}) they are simply returned as a string. This behaviour is more relaxed towards input errors but might delay failures from startup to runtime.

        If the base-keys lead to a non-defined (i.e. empty) node in the tree (no values have been read) an empty optional is returned.

        Type Parameters:
        T -
        Parameters:
        configurationBeanClass - The class of the configuration bean
        baseKeys - Where in the configuration tree should the values be taken from?
        Returns:
        An instance of configurationBeanClass filled with values taken from the configuration tree
      • instantiateConfigurationBeanStrict

        public <T> Optional<T> instantiateConfigurationBeanStrict​(Class<T> configurationBeanClass,
                                                                  String... baseKeys)
        Instantiates a bean of the given class. The base-keys denote the point from which the keys are taken. If values can not be substituted (e.g. ${key.that.does.not.exist}) an empty value is returned. This behaviour follows the "fail fast, fail early" approach.

        If the base-keys lead to a non-defined (i.e. empty) node in the tree (no values have been read) an empty optional is returned.

        Type Parameters:
        T -
        Parameters:
        configurationBeanClass - The class of the configuration bean
        baseKeys - Where in the configuration tree should the values be taken from?
        Returns:
        An instance of configurationBeanClass filled with values taken from the configuration tree
      • instantiateConfigurationBean

        public <T> T instantiateConfigurationBean​(com.fasterxml.jackson.core.type.TypeReference<T> configurationBeanType,
                                                  String... baseKeys)
      • readFromYaml

        public void readFromYaml​(String yamlSource,
                                 String... baseKeys)
      • readBoolean

        public boolean readBoolean​(String key)
      • readBoolean

        public boolean readBoolean​(String key,
                                   boolean defValue)
      • readTemplates

        public void readTemplates​(String templatesYaml,
                                  String... baseKeys)
      • loadEnvironmentVariables

        public void loadEnvironmentVariables()
      • loadSystemProperties

        public void loadSystemProperties()
      • putValue

        public void putValue​(String key,
                             String value)
      • putValue

        public void putValue​(String key,
                             Object value)
      • getObjectMapper

        public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()