Helper method used to retrieve the value from a given map if it matches the type specified.

@param configs The map to pull from.
@param key The key to pull.
@param type The expected type of the value.
@return
187309
private <T> T getEnvConfig(Map<String, ?> configs, String key, Class<T> type) {
    if(configs.containsKey(key)) {
      Object config = configs.get(key);
      if(type.isAssignableFrom(config.getClass())) {
        return type.cast(config);
      }
    }
    return null;
  }
1041451
function(key){
            this._configs = this._configs || {};
            var config = this._configs[key];
            
            if (!config || !this._configs.hasOwnProperty(key)) {
                return null;
            }
            
            return config.getValue();
        }
1288146
public static <K> void validateConfiguredKeyType(Class<K> keyType, K key) throws ClassCastException {
        if (Object.class != keyType) {
            // means that type checks is required
            if (!keyType.isAssignableFrom(key.getClass())) {
                throw new ClassCastException("Key '" + key + "' is not assignable to " + keyType);
            }
        }
    }
996031
public static String getValueWithGlobalDefault(String section, ConfigConstant key) {
    String value = getValue(section, key);
    return (Strings.isNullOrEmpty(value) ? getGlobalValue(key) : value);
  }
985050
public String get(String key, String defaultValue)
    {
        if( configs.containsKey(key) ){
            return configs.get(key);
        }

        return defaultValue;
    }
1041105
@SuppressWarnings({"unchecked", "unused"})
    public <T> T get(String key, Class<T> type) {
        try {
            return (T) state.get(key);
        } catch (ClassCastException cce) {
            return null;
        }
    }
1020882
protected String getConfig(IConfigKey key) {
        if (configs == null) {
            loadConfigs();
        }
        String value = configs.getProperty(key.getKeyString());
        if (value == null && key instanceof IConfigKeyHaveDefault) {
            return ((IConfigKeyHaveDefault) key).getDefaultValueStr();
        }
        return value;
    }
1331223
@SuppressWarnings("unchecked")
  public static Class<?> getValueType(Class<? extends CoreAnnotation> key) {
    Class type = valueCache.get(key);
    if (type == null) {
      try {
        type = key.newInstance().getType();
      } catch (Exception e) {
        throw new RuntimeException("Unexpected failure to instantiate - is your key class fancy?", e);
      }
      valueCache.put((Class)key, type);
    }
    return type;
  }
760189
protected Object extractSpecificConfig(String key)
    {
        if (this.specificConfig == null)
        {
            return null;
        }

        Object result = this.specificConfig.get(key);
        return result;
    }
1173933
public static SObject of(String key, InputStream is, Map<String, String> conf) {
        SObject sobj = of(key, is);
        sobj.setAttributes(conf);
        return sobj;
    }
907511
private <E> List<E> provide(TypeLiteral<Set<E>> type) {
        List<E> collection;
        try {
            Set<E> retrieved = injector.getInstance(Key.get(type));
            collection = retrieved.stream().filter(Objects::nonNull).collect(toList());

            if (collection.isEmpty()) {
                throw new ConfigurationException(new ArrayList<>());
            }

        } catch (ConfigurationException ce) {
            log.info(() -> "There is no registered instance of the type: ");
            collection = new ArrayList<>();
        }

        return collection;
    }
1269144
@SuppressWarnings("unchecked") public <R, W> Converter<R, W> getTypeConverter(Class<?> key) {
        return (Converter<R, W>) typeConverts.get(key);
    }
529387
protected boolean isConfigTrue(IConfigKey key) {
        String value = getConfig(key);
        if (value == null) {
            return false;
        }
        value = value.toLowerCase();
        return TRUE.equals(value);
    }
1366550
@SuppressWarnings({"rawtypes"})
    public static Map getMapValue(Config stormConf, String key)
    {
        Map configMap = (Map) stormConf.get(key);
        return configMap;
    }
825642
public boolean containsPathConfigs(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    return internalGetPathConfigs().getMap().containsKey(key);
  }
331172
public String get(ConfigKey pKey) {
        String value = params.get(pKey);
        if (value != null) {
            return value;
        } else {
            return pKey.getDefaultValue();
        }
    }
20437
private Optional getValueOfPrimitive(Class type, String key) {

        if (type.equals(String.class)) {
            return configurationUtil.get(key);
        } else if (type.equals(Boolean.class) || type.equals(boolean.class)) {
            return configurationUtil.getBoolean(key);
        } else if (type.equals(Float.class) || type.equals(float.class)) {
            return configurationUtil.getFloat(key);
        } else if (type.equals(Double.class) || type.equals(double.class)) {
            return configurationUtil.getDouble(key);
        } else if (type.equals(Integer.class) || type.equals(int.class)) {
            return configurationUtil.getInteger(key);
        } else if (type.equals(Long.class) || type.equals(long.class)) {
            return configurationUtil.getLong(key);
        } else {
            return Optional.empty();
        }

    }