Class ConfUtils


  • public class ConfUtils
    extends Object
    • Method Detail

      • getInt

        public static int getInt​(Map<String,​Object> conf,
                                 String prefix,
                                 String optional,
                                 String suffix,
                                 int defaultValue)
        Returns the value for prefix + optional + suffix, if nothing is found then return prefix + suffix and if that fails too, the default value
      • getFloat

        public static float getFloat​(Map<String,​Object> conf,
                                     String key,
                                     float defaultValue)
      • getBoolean

        public static boolean getBoolean​(Map<String,​Object> conf,
                                         String prefix,
                                         String optional,
                                         String suffix,
                                         boolean defaultValue)
        Returns the value for prefix + optional + suffix, if nothing is found then return prefix + suffix and if that fails too, the default value
      • getBoolean

        public static boolean getBoolean​(Map<String,​Object> conf,
                                         String key,
                                         boolean defaultValue)
      • getString

        public static String getString​(Map<String,​Object> stormConf,
                                       String prefix,
                                       String optional,
                                       String suffix)
        Returns the value for prefix + optional + suffix, if nothing is found then return prefix + suffix or null.
      • getString

        public static String getString​(Map<String,​Object> stormConf,
                                       String prefix,
                                       String optional,
                                       String suffix,
                                       String defaultValue)
        Returns the value for prefix + optional + suffix, if nothing is found then return prefix + suffix and if that fails too, the default value
      • loadListFromConf

        public static List<String> loadListFromConf​(String paramKey,
                                                    Map stormConf)
        Return one or more Strings regardless of whether they are represented as a single String or a list in the config or an empty List if no value could be found for that key.
      • loadListFromConf

        public static List<String> loadListFromConf​(String prefix,
                                                    String optional,
                                                    String suffix,
                                                    Map stormConf)
        Return one or more Strings regardless of whether they are represented as a single String or a list in the config for the combination all 2 String parameters. If nothing is found, try using the prefix and suffix only to see if a more generic param was set e.g. "opensearch." + "status." + "addresses" then "opensearch."+"addresses"
        Parameters:
        prefix - non-optional part of the key
        optional - string to be tried first
        suffix - non-optional part of the key
        Returns:
        List of String values
      • extractConfigElement

        public static Map extractConfigElement​(Map conf)
        If the config consists of a single key 'config', its values are used instead