@Test public void testGetEnvValue() { Map<String, String> env = new HashMap<>(); env.put("ORG_TEIID_SOME_LONG_VAL", "val"); assertEquals("val", PropertiesUtils.getValue("org.teiid.someLongVal", Collections.EMPTY_MAP, env)); }
static String getValue(String key, Map sysProps, Map<String, String> env) { Object val = sysProps.get(key); String stringVal = null; if (val instanceof String) { stringVal = val.toString(); } else { stringVal = env.get(key); if (stringVal == null) { String newKey = key.replaceAll("[.-]", "_"); newKey = newKey.replaceAll("([A-Z]|[a-z]+)([A-Z])", "$1_$2"); newKey = newKey.replaceAll("([A-Z]|[a-z]+)([A-Z])", "$1_$2"); stringVal = env.get(newKey.toUpperCase()); } } return stringVal; }
PropertiesUtils { static String getValue(String key, Map sysProps, Map<String, String> env) { Object val = sysProps.get(key); String stringVal = null; if (val instanceof String) { stringVal = val.toString(); } else { stringVal = env.get(key); if (stringVal == null) { String newKey = key.replaceAll("[.-]", "_"); newKey = newKey.replaceAll("([A-Z]|[a-z]+)([A-Z])", "$1_$2"); newKey = newKey.replaceAll("([A-Z]|[a-z]+)([A-Z])", "$1_$2"); stringVal = env.get(newKey.toUpperCase()); } } return stringVal; } }
PropertiesUtils { static String getValue(String key, Map sysProps, Map<String, String> env) { Object val = sysProps.get(key); String stringVal = null; if (val instanceof String) { stringVal = val.toString(); } else { stringVal = env.get(key); if (stringVal == null) { String newKey = key.replaceAll("[.-]", "_"); newKey = newKey.replaceAll("([A-Z]|[a-z]+)([A-Z])", "$1_$2"); newKey = newKey.replaceAll("([A-Z]|[a-z]+)([A-Z])", "$1_$2"); stringVal = env.get(newKey.toUpperCase()); } } return stringVal; }  }
PropertiesUtils { static String getValue(String key, Map sysProps, Map<String, String> env) { Object val = sysProps.get(key); String stringVal = null; if (val instanceof String) { stringVal = val.toString(); } else { stringVal = env.get(key); if (stringVal == null) { String newKey = key.replaceAll("[.-]", "_"); newKey = newKey.replaceAll("([A-Z]|[a-z]+)([A-Z])", "$1_$2"); newKey = newKey.replaceAll("([A-Z]|[a-z]+)([A-Z])", "$1_$2"); stringVal = env.get(newKey.toUpperCase()); } } return stringVal; }  static Properties clone( Properties props ); static Properties clone( Properties props, Properties defaults, boolean deepClone ); static void putAll(Properties addToThis,
                              Properties withThese); static int getIntProperty(Properties props, String propName, int defaultValue); static long getLongProperty(Properties props, String propName, long defaultValue); static float getFloatProperty(Properties props, String propName, float defaultValue); static double getDoubleProperty(Properties props, String propName, double defaultValue); static boolean getBooleanProperty(Properties props, String propName, boolean defaultValue); static Properties load(String fileName); static char toHex(int nibble); static String toHex(byte[] bytes); static byte[] fromHex(String hex); static void toHex(StringBuilder sb, InputStream is); static void setBeanProperties(Object bean, Properties props, String prefix); static void setBeanProperties(Object bean, Properties props, String prefix, boolean includeEnv); static void setBeanProperty(Object bean, String name, Object value); static String getHierarchicalProperty(String key, String defaultValue); static T getHierarchicalProperty(String key, T defaultValue, Class<T> clazz); static Properties getDefaultProperties(); }
PropertiesUtils { static String getValue(String key, Map sysProps, Map<String, String> env) { Object val = sysProps.get(key); String stringVal = null; if (val instanceof String) { stringVal = val.toString(); } else { stringVal = env.get(key); if (stringVal == null) { String newKey = key.replaceAll("[.-]", "_"); newKey = newKey.replaceAll("([A-Z]|[a-z]+)([A-Z])", "$1_$2"); newKey = newKey.replaceAll("([A-Z]|[a-z]+)([A-Z])", "$1_$2"); stringVal = env.get(newKey.toUpperCase()); } } return stringVal; }  static Properties clone( Properties props ); static Properties clone( Properties props, Properties defaults, boolean deepClone ); static void putAll(Properties addToThis,
                              Properties withThese); static int getIntProperty(Properties props, String propName, int defaultValue); static long getLongProperty(Properties props, String propName, long defaultValue); static float getFloatProperty(Properties props, String propName, float defaultValue); static double getDoubleProperty(Properties props, String propName, double defaultValue); static boolean getBooleanProperty(Properties props, String propName, boolean defaultValue); static Properties load(String fileName); static char toHex(int nibble); static String toHex(byte[] bytes); static byte[] fromHex(String hex); static void toHex(StringBuilder sb, InputStream is); static void setBeanProperties(Object bean, Properties props, String prefix); static void setBeanProperties(Object bean, Properties props, String prefix, boolean includeEnv); static void setBeanProperty(Object bean, String name, Object value); static String getHierarchicalProperty(String key, String defaultValue); static T getHierarchicalProperty(String key, T defaultValue, Class<T> clazz); static Properties getDefaultProperties();  }