All Downloads are FREE. Search and download functionalities are using the official Maven repository.

public.javadoc.org.spincast.plugins.config.ConfigFinder.html Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version






ConfigFinder (org.spincast:spincast-framework 1.14.0 API)












org.spincast.plugins.config

Class ConfigFinder

    • Constructor Detail

      • ConfigFinder

        protected ConfigFinder(String classpathFilePath,
                               String externalFilePath,
                               List<String> environmentVariablesPrefixes,
                               boolean environmentVariablesStripPrefix,
                               List<String> systemPropertiesPrefixes,
                               boolean systemPropertiesStripPrefix,
                               boolean externalFileConfigsOverrideEnvironmentVariables,
                               boolean throwExceptionIfSpecifiedClasspathConfigFileIsNotFound,
                               boolean throwExceptionIfSpecifiedExternalConfigFileIsNotFound)
        This component is not part of the Guice context because you can very easily created circular dependencies with configurations since they are used everywhere.
    • Method Detail

      • getClasspathFilePath

        protected String getClasspathFilePath()
      • getExternalFilePath

        protected String getExternalFilePath()
      • getEnvironmentVariablesPrefixes

        protected List<String> getEnvironmentVariablesPrefixes()
      • isEnvironmentVariablesStripPrefix

        protected boolean isEnvironmentVariablesStripPrefix()
      • getSystemPropertiesPrefixes

        protected List<String> getSystemPropertiesPrefixes()
      • isSystemPropertiesStripPrefix

        protected boolean isSystemPropertiesStripPrefix()
      • isExternalFileConfigsOverrideEnvironmentVariables

        protected boolean isExternalFileConfigsOverrideEnvironmentVariables()
      • isThrowExceptionIfSpecifiedClasspathConfigFileIsNotFound

        protected boolean isThrowExceptionIfSpecifiedClasspathConfigFileIsNotFound()
      • isThrowExceptionIfSpecifiedExternalConfigFileIsNotFound

        protected boolean isThrowExceptionIfSpecifiedExternalConfigFileIsNotFound()
      • getRawConfigs

        protected Map<String,Object> getRawConfigs()
        Get raw configs, as a Map
      • loadYamlFileConfigs

        protected void loadYamlFileConfigs(File configFile,
                                           org.yaml.snakeyaml.Yaml yaml)
      • getEnvironmentVariablesConfigs

        protected Map<String,Object> getEnvironmentVariablesConfigs()
      • getSystemPropertiesConfigs

        protected Map<String,Object> getSystemPropertiesConfigs()
      • expandMap

        protected Map<String,Object> expandMap(Map<String,Object> sourceMap)
        Parses the keys of the map as "dotted paths" and created an expanded Map from them.
      • mergeMaps

        protected Map<String,Object> mergeMaps(Map<String,Object> map1,
                                               Map<String,Object> map2)
        Merges two maps : The elements from the second map override the elements of the first map of the same path, except for Map elements which are merged.
      • getRawConfig

        public Object getRawConfig(String dottedKey)
        Gets a config from the raw Map. The dotted key will be parsed as the path to use.
      • getConfigFromMap

        public Object getConfigFromMap(Map<String,Object> map,
                                       String dottedKey)
        Gets a config from the given Map. The dotted key will be parsed as the path to use.
        Returns:
        the config value or null if not found.
      • getConfigFromMap

        public Object getConfigFromMap(Map<String,Object> map,
                                       String dottedKey,
                                       Object defaultValue)
        Gets a config from the given Map. The dotted key will be parsed as the path to use.
        Returns:
        the config value or the default value if not found.
      • getConfig

        public Object getConfig(String key,
                                Object defaultValue)
        Gets an untype config from the config map. If the config isn't there, we'll try to get it from the raw configs map.

        If the resulting config is null, the default value will be returned.

      • getBooleanFromElement

        protected Boolean getBooleanFromElement(Object val)
      • getIntegerFromElement

        protected Integer getIntegerFromElement(Object val)
      • getLongFromElement

        protected Long getLongFromElement(Object val)
      • getBigDecimalFromElement

        protected BigDecimal getBigDecimalFromElement(Object val)
      • getDateFromElement

        protected Date getDateFromElement(Object date)
      • getAppJarDirectory

        protected File getAppJarDirectory()
        If the project is running from an executable .jar file, this will return the directory containing this .jar file.
        Returns:
        the directory path or null if the application is not running from an executable .jar file.
      • getAppRootDirectoryNoJar

        protected File getAppRootDirectoryNoJar()
        If the project is not running from an executable .jar file, this will return the root directory of the project on the file system.
        Returns:
        the directory path or null if the application is running from an executable .jar file.

Copyright © 2019. All rights reserved.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy