List of utility methods to do Properties Get
void | clearPrefixedSystemProperties(String prefix, Map clearPrefixedSystemProperties clears System Properties by writing null properties in the targetPropertyMap that match a prefix for (Object o : System.getProperties().keySet()) { String propertyName = (String) o; if (propertyName.startsWith(prefix) && !targetPropertyMap.containsKey(propertyName)) { targetPropertyMap.put(propertyName, null); |
void | copyProperties(Hashtable src, Hashtable target) This API copies the properties from src hashtable to the target hashtable Enumeration keys = src.keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
Object value = src.get(key);
target.put(key, value);
|
boolean | getBoolean(Properties props, String key) get Boolean return getBoolean(props, key, false);
|
boolean | getBoolean(Properties props, String name, boolean defaultValue) get Boolean if (!props.containsKey(name)) return defaultValue; return "true".equalsIgnoreCase(props.getProperty(name)); |
int | getInt(Properties props, String name) get Int if (props.containsKey(name)) { return getInt(props, name, -1); throw new IllegalArgumentException("Missing required property '" + name + "'"); |
int | getInt(Properties props, String name, int defaultValue) get Int return getIntInRange(props, name, defaultValue, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
Map | getIntersectionOfPropertyValues(Properties propertyFileOne, Properties propertyFileTwo) get Intersection Of Property Values Map<String, String> intersection = new HashMap<String, String>(); for (String key : propertyFileOne.stringPropertyNames()) { String propertyOneValue = propertyFileOne.getProperty(key); String propertyTwoValue = propertyFileTwo.getProperty(key); if (propertyOneValue != null && propertyTwoValue != null && propertyOneValue.equals(propertyTwoValue)) { intersection.put(key, propertyOneValue); return intersection; |
int | getIntInRange(Properties props, String name, int defaultValue, int min, int max) get Int In Range int v = defaultValue; if (props.containsKey(name)) { v = Integer.valueOf(props.getProperty(name)); if (v >= min && v <= max) { return v; throw new IllegalArgumentException(name + " has value " + v + " which is not in the range"); ... |
int | getIntProperty(Properties props, String keyword, int defaultValue) get Int Property int rv = defaultValue; if (props != null) { String s = props.getProperty(keyword); if (s != null) { s = s.trim(); if (!s.isEmpty()) { try { rv = Integer.parseInt(s); ... |
boolean | getIsB37PropertyValue(final Properties dataSourceProperties) Get if the properties has specified the `isB37` field #CONFIG_FILE_FIELD_NAME_IS_B37_DATA_SOURCE as true. if (dataSourceProperties.containsKey(CONFIG_FILE_FIELD_NAME_IS_B37_DATA_SOURCE)) { return Boolean.valueOf( dataSourceProperties.getProperty(CONFIG_FILE_FIELD_NAME_IS_B37_DATA_SOURCE).replace(" ", "")); return false; |