Package readycli
Class OptionValues
java.lang.Object
readycli.OptionValues
- All Implemented Interfaces:
java.io.Serializable
public final class OptionValues
extends java.lang.Object
implements java.io.Serializable
An instance of this class represents a particular assignment of the
parameters of an
Option
. Therefore, an instance of this class, allows
to access the actual values of the parameters of an Option
by their
names, through the get(String)
method, and allows to know if the
option has been specified on the command-line, through the getFlag()
method.- Author:
- Salvatore Giampa'
- See Also:
- Serialized Form
-
Method Summary
Modifier and Type Method Description java.lang.String
get(java.lang.String name)
Gets theString
value of the specified parameter.boolean
getFlag()
Allows to know if the option was specified on the command-line.java.lang.String
getOptionName()
Gets the option name.java.util.Map<java.lang.String,java.lang.String>
getParameters()
Gets the map of all parameters values of the option.java.lang.String
toString()
-
Method Details
-
getOptionName
public java.lang.String getOptionName()Gets the option name.- Returns:
- the name of the option
-
getFlag
public boolean getFlag()Allows to know if the option was specified on the command-line. It is useful for flags (i.e. parameterless options) to obtain their boolean values.- Returns:
- true if this option was specified, false otherwise.
-
getParameters
public java.util.Map<java.lang.String,java.lang.String> getParameters()Gets the map of all parameters values of the option.- Returns:
- an unmodifiable map of all parameters values
-
get
public java.lang.String get(java.lang.String name)Gets theString
value of the specified parameter.- Parameters:
name
- the name of the parameter to get the value of- Returns:
- the value associated to the given parameter name
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-