public final class ParameterUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.String,java.lang.String> |
parms
The parameters known to this utility class.
|
| Modifier | Constructor and Description |
|---|---|
private |
ParameterUtil(java.util.Map<java.lang.String,java.lang.String> params)
Initializes the known parameters.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
fetchBool(java.lang.String key)
Returns the
boolean value of a supplied key if known to the class or false instead by
using fetchBool(String, boolean). |
boolean |
fetchBool(java.lang.String key,
boolean defVal)
Returns the
boolean value of a supplied key if known to the class or the supplied default value
instead. |
int |
fetchInt(java.lang.String key)
Returns the
int value of a supplied key if known to the class or 0 instead by using
fetchInt(String, int). |
int |
fetchInt(java.lang.String key,
int defVal)
Returns the
int value of a supplied key if known to the class or the supplied default value instead. |
private static java.util.Map<java.lang.String,java.lang.String> |
fetchParms(java.lang.String[] args,
java.lang.String[] subset)
Fetches a map of arguments from a system supplied argument string array which contains only the ones supplied in
the subset parameter.
|
java.lang.String |
fetchString(java.lang.String key)
Returns the
String value of a supplied key if known to the class or null instead by using
fetchString(String, String). |
java.lang.String |
fetchString(java.lang.String key,
java.lang.String defVal)
Returns the
String value of a supplied key if known to the class or the supplied default value instead. |
static ParameterUtil |
fromArgs(java.lang.String[] args,
java.lang.String[] subset)
Creates a
ParameterUtil object of certain attributes from the system supplied argument string array by
using fetchParms(String[], String[]). |
boolean |
isset(java.lang.String key)
Checks whether a certain key as
String is known as parameter to the current class instance or not. |
boolean |
someset(java.lang.String[] keys)
Checks if at least one parameter of the supplied
String array is known to this class instance. |
private java.util.Map<java.lang.String,java.lang.String> parms
private ParameterUtil(java.util.Map<java.lang.String,java.lang.String> params)
params - The known parameters.public static ParameterUtil fromArgs(java.lang.String[] args, java.lang.String[] subset)
ParameterUtil object of certain attributes from the system supplied argument string array by
using fetchParms(String[], String[]).args - The system supplied argument string array.subset - The requested subset of arguments.ParameterUtil object containing the requested subset of arguments if existing.private static java.util.Map<java.lang.String,java.lang.String> fetchParms(java.lang.String[] args,
java.lang.String[] subset)
args - The system supplied argument string array.subset - The requested subset of arguments.Map of String to String containing the requested system arguments.public java.lang.String fetchString(java.lang.String key)
String value of a supplied key if known to the class or null instead by using
fetchString(String, String).key - The name of the requested argument as String.null instead.public java.lang.String fetchString(java.lang.String key,
java.lang.String defVal)
String value of a supplied key if known to the class or the supplied default value instead.key - The name of the requested argument as String.defVal - The default value of the argument as String, which will be returned in case the key is
unknown or undefined.public int fetchInt(java.lang.String key)
int value of a supplied key if known to the class or 0 instead by using
fetchInt(String, int).key - The name of the requested argument as String.0 instead.public int fetchInt(java.lang.String key,
int defVal)
int value of a supplied key if known to the class or the supplied default value instead.key - The name of the requested argument as String.defVal - The default value of the argument as int, which will be returned in case the key is
unknown or undefined.public boolean fetchBool(java.lang.String key)
boolean value of a supplied key if known to the class or false instead by
using fetchBool(String, boolean).key - The name of the requested argument as String.false instead.public boolean fetchBool(java.lang.String key,
boolean defVal)
boolean value of a supplied key if known to the class or the supplied default value
instead.key - The name of the requested argument as String.defVal - The default value of the argument as boolean, which will be returned in case the
key is unknown or undefined.public boolean isset(java.lang.String key)
String is known as parameter to the current class instance or not.key - The name of the requested parameter as String.true if the parameter is known, otherwise false.public boolean someset(java.lang.String[] keys)
String array is known to this class instance.keys - A String array of parameters.true if at least one parameter of the supplied String array is known to
this class instance, otherwise false.