org.jboss.soa.esb.helpers
Class KeyValuePair

java.lang.Object
  extended by org.jboss.soa.esb.helpers.KeyValuePair
All Implemented Interfaces:
java.io.Serializable

public class KeyValuePair
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Constructor Summary
KeyValuePair(java.lang.String pKey, java.lang.String pVal)
           
 
Method Summary
 java.lang.String dump()
           
static boolean getBooleanValue(java.lang.String key, java.util.List<KeyValuePair> list, boolean defaultVal)
          Get the boolean equivalent value associated with the specified key from the supplied list of Key Value Pairs.
static double getDoubleValue(java.lang.String key, java.util.List<KeyValuePair> list, double defaultVal)
          Get the numeric double equivalent value associated with the specified key from the supplied list of Key Value Pairs.
 java.lang.String getKey()
           
 java.lang.String getValue()
           
static java.lang.String getValue(java.lang.String key, java.util.List<KeyValuePair> list)
          Get the value associated with the specified key from the supplied list of Key Value Pairs.
static java.lang.String getValue(java.lang.String key, java.util.List<KeyValuePair> list, java.lang.String defaultVal)
          Get the value associated with the specified key from the supplied list of Key Value Pairs.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyValuePair

public KeyValuePair(java.lang.String pKey,
                    java.lang.String pVal)
Method Detail

getKey

public java.lang.String getKey()

getValue

public java.lang.String getValue()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

dump

public java.lang.String dump()

getValue

public static java.lang.String getValue(java.lang.String key,
                                        java.util.List<KeyValuePair> list)
Get the value associated with the specified key from the supplied list of Key Value Pairs.

Returns the value from the first matching key.

Parameters:
key - The key to search for.
list - The list of KeyValuePairs to search.
Returns:
The value associated with the supplied key, or null if key not found.

getValue

public static java.lang.String getValue(java.lang.String key,
                                        java.util.List<KeyValuePair> list,
                                        java.lang.String defaultVal)
Get the value associated with the specified key from the supplied list of Key Value Pairs.

Returns the value from the first matching key.

Parameters:
key - The key to search for.
list - The list of KeyValuePairs to search.
defaultVal - The default value to be returned where there's no value available for the specified key.
Returns:
The value associated with the supplied key, or null if key not found.

getBooleanValue

public static boolean getBooleanValue(java.lang.String key,
                                      java.util.List<KeyValuePair> list,
                                      boolean defaultVal)
Get the boolean equivalent value associated with the specified key from the supplied list of Key Value Pairs.

Returns:

Returns the value from the first matching key.

Parameters:
key - The key to search for.
list - The list of KeyValuePairs to search.
defaultVal - The default value to be returned where the above listed conditions do not hold for the associated value, or the value is not specified.
Returns:
The boolean equivalent value associated with the specified key according to the above specified rules, otherwise the defaultVal is returned.

getDoubleValue

public static double getDoubleValue(java.lang.String key,
                                    java.util.List<KeyValuePair> list,
                                    double defaultVal)
Get the numeric double equivalent value associated with the specified key from the supplied list of Key Value Pairs.

Returns the value from the first matching key.

Parameters:
key - The key to search for.
list - The list of KeyValuePairs to search.
defaultVal - The default value to be returned where the value is not found or is non-numeric.
Returns:
The double equivalent value associated with the specified key if the value is found and is numeric, otherwise the defaultVal is returned.