Package org.opennms.core.utils
Class ParameterMap
- java.lang.Object
-
- org.opennms.core.utils.ParameterMap
-
public abstract class ParameterMap extends java.lang.ObjectConvenience class for looking up string and integer values in a parameter map.
-
-
Constructor Summary
Constructors Constructor Description ParameterMap()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.IntegergetIntValue(java.lang.String key, java.lang.Object value, java.lang.Integer defaultValue)static booleangetKeyedBoolean(java.util.Map map, java.lang.String key, boolean defValue)This method is used to lookup a specific key in the map.static intgetKeyedDecodedInteger(java.util.Map map, java.lang.String key, int defValue)This method is used to lookup a specific key in the map.static longgetKeyedDecodedLong(java.util.Map map, java.lang.String key, long defValue)This method is used to lookup a specific key in the map.static intgetKeyedInteger(java.util.Map map, java.lang.String key, int defValue)This method is used to lookup a specific key in the map.static int[]getKeyedIntegerArray(java.util.Map map, java.lang.String key, int[] defValues)This method is used to lookup a specific key in the map.static longgetKeyedLong(java.util.Map map, java.lang.String key, long defValue)This method is used to lookup a specific key in the map.static longgetKeyedLongImmutable(java.util.Map map, java.lang.String key, long defValue)Same as getKeyedLong, but does not mutate the mapstatic java.lang.StringgetKeyedString(java.util.Map map, java.lang.String key, java.lang.String defValue)This method is used to lookup a specific key in the map.static <T> TgetKeyedValue(java.util.Map<java.lang.String,T> map, java.lang.String key, T defValue)This method is used to lookup a specific key in the map.static java.lang.LonggetLongValue(java.lang.String key, java.lang.Object value, java.lang.Long defaultValue)
-
-
-
Method Detail
-
getKeyedLong
public static long getKeyedLong(java.util.Map map, java.lang.String key, long defValue)This method is used to lookup a specific key in the map. If the mapped value is a string it is converted to a long and the original string value is replaced in the map. The converted value is returned to the caller. If the value cannot be converted then the default value is stored in the map. If the specified key does not exist in the map then the default value is returned.- Parameters:
map- aMapobject.key- aStringobject.defValue- a long.- Returns:
- The long value associated with the key.
-
getKeyedLongImmutable
public static long getKeyedLongImmutable(java.util.Map map, java.lang.String key, long defValue)Same as getKeyedLong, but does not mutate the map
-
getKeyedDecodedLong
public static long getKeyedDecodedLong(java.util.Map map, java.lang.String key, long defValue)This method is used to lookup a specific key in the map. If the mapped value is a string it is converted to a long and the original string value is replaced in the map. The converted value is returned to the caller. If the value cannot be converted then the default value is stored in the map. If the specified key does not exist in the map then the default value is returned.- Parameters:
map- aMapobject.key- aStringobject.defValue- a long.- Returns:
- The long value associated with the key.
-
getKeyedInteger
public static int getKeyedInteger(java.util.Map map, java.lang.String key, int defValue)This method is used to lookup a specific key in the map. If the mapped value is a string it is converted to an integer and the original string value is replaced in the map. The converted value is returned to the caller. If the value cannot be converted then the default value is stored in the map. If the specified key does not exist in the map then the default value is returned.- Parameters:
map- aMapobject.key- aStringobject.defValue- a int.- Returns:
- The int value associated with the key.
-
getKeyedIntegerArray
public static final int[] getKeyedIntegerArray(java.util.Map map, java.lang.String key, int[] defValues)This method is used to lookup a specific key in the map. If the mapped value is a string is is converted to an integer and the original string value is replaced in the map. The converted value is returned to the caller. If the value cannot be converted then the default value is used.- Parameters:
map- aMapobject.key- aStringobject.defValues- an array of int.- Returns:
- The array of integer values associated with the key.
-
getKeyedDecodedInteger
public static int getKeyedDecodedInteger(java.util.Map map, java.lang.String key, int defValue)This method is used to lookup a specific key in the map. If the mapped value is a string it is converted to an integer and the original string value is replaced in the map. The converted value is returned to the caller. If the value cannot be converted then the default value is stored in the map. If the specified key does not exist in the map then the default value is returned.- Parameters:
map- aMapobject.key- aStringobject.defValue- a int.- Returns:
- The int value associated with the key.
-
getKeyedString
public static java.lang.String getKeyedString(java.util.Map map, java.lang.String key, java.lang.String defValue)This method is used to lookup a specific key in the map. If the mapped value is not a String it is converted to a String and the original value is replaced in the map. The converted value is returned to the caller. If the specified key does not exist in the map then the default value is returned.- Parameters:
map- aMapobject.key- aStringobject.defValue- aStringobject.- Returns:
- The String value associated with the key.
-
getKeyedBoolean
public static boolean getKeyedBoolean(java.util.Map map, java.lang.String key, boolean defValue)This method is used to lookup a specific key in the map. If the mapped value is a string it is converted to a boolean and the original string value is replaced in the map. The converted value is returned to the caller. If the value cannot be converted then the default value is stored in the map. If the specified key does not exist in the map then the default value is returned.- Parameters:
map- aMapobject.key- aStringobject.defValue- a boolean.- Returns:
- The bool value associated with the key.
-
getKeyedValue
public static <T> T getKeyedValue(java.util.Map<java.lang.String,T> map, java.lang.String key, T defValue)This method is used to lookup a specific key in the map. If the value cannot be found in the map then the default value is stored in the map. If the specified key does not exist in the map then the default value is returned.
-
getLongValue
public static java.lang.Long getLongValue(java.lang.String key, java.lang.Object value, java.lang.Long defaultValue)
-
getIntValue
public static java.lang.Integer getIntValue(java.lang.String key, java.lang.Object value, java.lang.Integer defaultValue)
-
-