public class Parameters extends Object
serializable
parameter objects parsed from the command line arguments.
Some parameters can be marked as indexed, which means that there can be more than one specified on the command-line. Such parameters can be accessed using an index between 0 and the number of parameter occurrences, where the index value corresponds to the order in which they were specified on the command line.
Constructor and Description |
---|
Parameters()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Parameters parameters)
Adds all bindings from the given parameter map to this parameter map.
|
void |
add(String name,
Serializable object,
boolean isIndexed)
Adds the specified name/object binding to the parameter map.
|
Serializable |
get(String name)
Returns the parameter object associated with the parameter name.
|
Serializable |
get(String name,
int index)
Returns the indexed parameter object associated with the parameter
name.
|
List<Object> |
getList(String name)
Get list of values associated with the specified indexed parameter
name.
|
List<String> |
getNames()
Returns an unmodifiable set of all parameters names in this map.
|
int |
getOccurrences(String name)
Returns the number of occurrences of the given indexed parameter.
|
boolean |
isIndexed(String name)
Returns true if the given parameter values are indexed.
|
boolean |
isPresent(String name)
Determines whether a parameter with the specified name is present.
|
int |
size()
Get the count of the parameters.
|
String |
toString() |
public int size()
public boolean isPresent(String name)
name
- Name of the parameter whose presence we are testing.public boolean isIndexed(String name)
name
- Name of the parameter.public int getOccurrences(String name)
name
- Name of the parameter whose presence we are testing.public Serializable get(String name)
name
- Name of the parameter.public Serializable get(String name, int index)
name
- Name of the parameter.index
- Index (starting with 0), of the value associated with the
parameter name.public List<Object> getList(String name)
name
- Name of the indexed parameter.public void add(String name, Serializable object, boolean isIndexed)
name
- Name of the parameter.object
- Serializable value to be mapped to the parameter name.isIndexed
- True if the parameter value is to be marked as
indexed, i.e. there could be more than one value associated with
the given parameter name.public void add(Parameters parameters)
parameters
- The parameters map whose name/object bindings are to
be imported to this map.public List<String> getNames()
Copyright © 2016. All Rights Reserved.