org.opennms.core.utils
Class ParameterMap

java.lang.Object
  extended by org.opennms.core.utils.ParameterMap

public abstract class ParameterMap
extends Object

Convenience class for looking up string and integer values in a parameter map.

Version:
$Id: $
Author:
ranger

Constructor Summary
ParameterMap()
           
 
Method Summary
static boolean getKeyedBoolean(Map map, String key, boolean defValue)
          This method is used to lookup a specific key in the map.
static int getKeyedInteger(Map map, String key, int defValue)
          This method is used to lookup a specific key in the map.
static int[] getKeyedIntegerArray(Map map, String key, int[] defValues)
          This method is used to lookup a specific key in the map.
static long getKeyedLong(Map map, String key, long defValue)
          This method is used to lookup a specific key in the map.
static String getKeyedString(Map map, String key, String defValue)
          This method is used to lookup a specific key in the map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParameterMap

public ParameterMap()
Method Detail

getKeyedLong

public static long getKeyedLong(Map map,
                                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 - a Map object.
key - a String object.
defValue - a long.
Returns:
The long value associated with the key.

getKeyedInteger

public static int getKeyedInteger(Map map,
                                  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 - a Map object.
key - a String object.
defValue - a int.
Returns:
The int value associated with the key.

getKeyedIntegerArray

public static final int[] getKeyedIntegerArray(Map map,
                                               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 - a Map object.
key - a String object.
defValues - an array of int.
Returns:
The array of integer values associated with the key.

getKeyedString

public static String getKeyedString(Map map,
                                    String key,
                                    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 - a Map object.
key - a String object.
defValue - a String object.
Returns:
The String value associated with the key.

getKeyedBoolean

public static boolean getKeyedBoolean(Map map,
                                      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 - a Map object.
key - a String object.
defValue - a boolean.
Returns:
The bool value associated with the key.


Copyright © 2011. All Rights Reserved.