Class AzkarraConf

    • Constructor Detail

      • AzkarraConf

        protected AzkarraConf​(com.typesafe.config.Config config)
        Creates a new AzkarraConf instance.
        Parameters:
        config - the Config instance to used as default configuration.
    • Method Detail

      • create

        public static AzkarraConf create​(String resourceBasename)
        Static helper that can be used to creates a new AzkarraConf instance using the specified resource base name.
        Returns:
        a new AzkarraConf instance.
      • create

        public static AzkarraConf create()
        Static helper that can be used to creates a new AzkarraConf instance that loads a default configuration.

        This method loads the following (first-listed are higher priority):

        • system properties
        • application.conf (all resources on classpath with this name)
        • application.json (all resources on classpath with this name)
        • application.properties (all resources on classpath with this name)
        • reference.conf (all resources on classpath with this name)

        Returns:
        a new AzkarraConf instance.
      • keySet

        public Set<String> keySet()
        Returns a Set view of the keys contained in this conf.
        Returns:
        a set view of the keys contained in this conf
      • getValue

        public Object getValue​(String path)
        Gets a required parameter value.
        Parameters:
        path - the parameter path.
        Returns:
        the object value.
      • getString

        public String getString​(String path)
        Gets a required parameter as a string.
        Parameters:
        path - the parameter path.
        Returns:
        the parameter value as a string.
      • getLong

        public long getLong​(String key)
        Gets a required parameter as a long.
        Parameters:
        key - the parameter path.
        Returns:
        the parameter value as a long.
      • getInt

        public int getInt​(String key)
        Gets a required parameter as an integer.
        Parameters:
        key - the parameter path.
        Returns:
        the parameter value as a int.
      • getBoolean

        public boolean getBoolean​(String key)
        Gets a required parameter as an boolean.
        Parameters:
        key - the parameter path.
        Returns:
        the parameter value as a boolean.
      • getDouble

        public double getDouble​(String key)
        Gets a required parameter as a double.
        Parameters:
        key - the parameter path.
        Returns:
        the parameter value as a double.
      • getStringList

        public List<String> getStringList​(String key)
        Gets a required parameter as a list.
        Parameters:
        key - the parameter path.
        Returns:
        a string list value.
      • getSubConf

        public Conf getSubConf​(String key)
        Gets a required parameter as a Conf.
        Parameters:
        key - the parameter path.
        Returns:
        a new Conf instance.
      • getSubConfList

        public List<Conf> getSubConfList​(String key)
        Gets a required parameter as a list of Conf.
        Parameters:
        key - the parameter path.
        Returns:
        a new list of Conf instances.
      • hasPath

        public boolean hasPath​(String key)
        Checks whether the specified path exists into this Conf.
        Parameters:
        key - the path to be checked.
        Returns:
        true if the path exists, false otherwise.
      • withFallback

        public Conf withFallback​(Conf defaults)
      • getConfAsMap

        public Map<String,​Object> getConfAsMap()
        Converts this Conf into a path-value map.
        Returns:
        a new Map instance containing the configuration values.
      • getConfAsProperties

        public Properties getConfAsProperties()
        Converts this Conf into a properties.
        Returns:
        a new Properties instance containing the configuration values.