com.calfater.mailcarbon.util
Class Parameter

java.lang.Object
  extended by com.calfater.mailcarbon.util.Parameter

public class Parameter
extends java.lang.Object

This class helps to obtain informations from the command line.

Author:
sebastien borie

Constructor Summary
Parameter(java.lang.String[] args)
          The constructor.
 
Method Summary
 boolean exists(java.lang.String key)
          Verify if the key exists in parameters.
 boolean exists(java.lang.String[] keys)
          Verify if one of the keys exists in parameters.
 java.lang.String getValue(java.lang.String key)
          Get the value associated with a key.
 java.lang.String getValue(java.lang.String[] keys)
          Get the value associated with a key list
 java.lang.String getValue(java.lang.String[] keys, java.lang.String defaultValue)
          Get the value associated with a key list
 java.lang.String getValue(java.lang.String key, java.lang.String defaultValue)
          Get the value associated with a key
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parameter

public Parameter(java.lang.String[] args)
The constructor.

Parameters:
args - command line arguments.
Method Detail

exists

public boolean exists(java.lang.String[] keys)
Verify if one of the keys exists in parameters.

Parameters:
keys - a list of key name
Returns:
true, if successful

exists

public boolean exists(java.lang.String key)
Verify if the key exists in parameters.

Parameters:
key - the key's name
Returns:
true if the parameter is present

getValue

public java.lang.String getValue(java.lang.String key)
Get the value associated with a key.

Parameters:
key - The name of the parameter.
Returns:
the value if one of the key is found and has a value
null if the parameter does not exists

getValue

public java.lang.String getValue(java.lang.String[] keys)
Get the value associated with a key list

Parameters:
keys - a list of key name
Returns:
the value if one of the key is found and has a value
null if the parameter does not exists

getValue

public java.lang.String getValue(java.lang.String key,
                                 java.lang.String defaultValue)
Get the value associated with a key

Parameters:
key - the key name
defaultValue - the default value
Returns:
the value if the key is found and has a value
Otherwise returns the default value

getValue

public java.lang.String getValue(java.lang.String[] keys,
                                 java.lang.String defaultValue)
Get the value associated with a key list

Parameters:
key - the key name
defaultValue - the default value
Returns:
the value if one of the keys is found and has a value
Otherwise returns the default value


Copyright © 2010. All Rights Reserved.