|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.doolin.util.ParameterSet
public class ParameterSet
Set of parameters that provides the developer a list of utility methods to retrieve values from.
| Constructor Summary | |
|---|---|
ParameterSet()
Empty constructor |
|
ParameterSet(Map<String,String> map)
Constructor from an existing map |
|
ParameterSet(Properties properties)
Constructor from a set of properties |
|
| Method Summary | |
|---|---|
void |
addParam(String name,
boolean value)
Adds a boolean parameter |
void |
addParam(String name,
int value)
Adds an integer parameter |
void |
addParam(String name,
String value)
Add a parameter |
void |
addParams(Map<String,String> params)
Adds a set of parameters |
boolean |
getBooleanParam(String name,
boolean mandatory,
boolean defaultValue)
Get a boolean parameter |
Object |
getConstant(String name,
Class<?> type,
boolean mandatory,
Object defaultValue)
Gets a parameter as a constant name for a given class and then uses this constant name to get its actual value. |
double |
getDoubleParam(String name,
boolean mandatory,
double defaultValue)
Get a double parameter |
int |
getIntParam(String name,
boolean mandatory,
int defaultValue)
Get an int parameter |
String |
getParam(String name)
Get a parameter as a string |
String |
getParam(String name,
boolean mandatory,
String defaultValue)
Get a string parameter |
Map<String,String> |
getParams()
Read-only access to parameters |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ParameterSet()
public ParameterSet(Map<String,String> map)
map - Existing map. This map is not directly used by the parameter
set since it is duplicated.public ParameterSet(Properties properties)
properties - Set of properties to get parameters from| Method Detail |
|---|
public void addParam(String name,
boolean value)
name - Parameter's namevalue - Parameter's value
public void addParam(String name,
int value)
name - Parameter's namevalue - Parameter's value
public void addParam(String name,
String value)
name - Parameter's namevalue - Parameter's valuepublic void addParams(Map<String,String> params)
params - Parameters to be added
public boolean getBooleanParam(String name,
boolean mandatory,
boolean defaultValue)
throws MissingParameterException
name - Parameter's namemandatory - Indicates if the parameter must be present.defaultValue - Value to be used if the parameter is not found and if it is
not mandatory.
null if not found.
MissingParameterException - If the parameter is not found when it is mandatory.
public Object getConstant(String name,
Class<?> type,
boolean mandatory,
Object defaultValue)
getConstant("key", SwingConstants.class, true, null) will
return the value for SwingConstant.LEFT if the value
associated with "key" is "LEFT".
name - Key nametype - Type that contains the constant definitionmandatory - true if the value is requireddefaultValue - Default value if the value is not required and if the key is
not found
null
public double getDoubleParam(String name,
boolean mandatory,
double defaultValue)
throws MissingParameterException
name - Parameter's namemandatory - Indicates if the parameter must be present.defaultValue - Value to be used if the parameter is not found and if it is
not mandatory.
null if not found.
MissingParameterException - If the parameter is not found when it is mandatory.
public int getIntParam(String name,
boolean mandatory,
int defaultValue)
throws MissingParameterException
name - Parameter's namemandatory - Indicates if the parameter must be present.defaultValue - Value to be used if the parameter is not found and if it is
not mandatory.
null if not found.
MissingParameterException - If the parameter is not found when it is mandatory.public String getParam(String name)
name - Parameter's name
null if not found.
public String getParam(String name,
boolean mandatory,
String defaultValue)
throws MissingParameterException
name - Parameter's namemandatory - Indicates if the parameter must be present.defaultValue - Value to be used if the parameter is not found and if it is
not mandatory.
null if not found.
MissingParameterException - If the parameter is not found when it is mandatory.public Map<String,String> getParams()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||