T
- type of executablepublic class Option<T> extends java.lang.Object implements Argument<T>
Modifier and Type | Field and Description |
---|---|
private java.net.URL |
basicURL |
protected java.lang.String |
defaultValue |
protected java.lang.String |
description |
protected java.lang.String |
furtherDetails |
protected boolean |
isRequired |
protected java.lang.String |
name |
(package private) java.util.Set<java.lang.String> |
optionNames |
Constructor and Description |
---|
Option() |
Option(java.lang.String name,
java.lang.String description) |
Modifier and Type | Method and Description |
---|---|
java.util.Set<java.lang.String> |
addOptionNames(java.lang.String... value)
Adds an option to the optionName list
|
boolean |
equals(java.lang.Object obj) |
java.net.URL |
getBasicURL() |
java.lang.String |
getDefaultValue()
A default value of the option.
|
java.lang.String |
getDescription()
A long description of the Option
|
java.lang.String |
getFurtherDetails()
The URL where further details about the option can be found
|
java.lang.String |
getName()
Human readable name of the option
|
java.util.List<java.lang.String> |
getOptionNames() |
java.util.List<java.lang.String> |
getPossibleValues()
List of possible optionNames
|
int |
hashCode() |
boolean |
isRequired()
Flag that indicated that this option must be specified in the command
line for an executable to run
|
void |
setBasicURL(java.net.URL url) |
void |
setDefaultValue(java.lang.String defaultVal)
Sets one of the values defined in optionList as default.
|
void |
setDescription(java.lang.String description) |
void |
setFurtherDetails(java.lang.String furtherDetails) |
void |
setName(java.lang.String name) |
void |
setOptionNames(java.util.Set<java.lang.String> optionNames) |
void |
setRequired(boolean isRequired) |
void |
setValue(java.lang.String dValue)
Set default values for the parameter or an option
|
java.lang.String |
toCommand(java.lang.String nameValueSeparator)
Convert the option to the command string.
|
java.lang.String |
toString() |
(package private) void |
validate()
Validate the option
|
(package private) static boolean |
valueExist(java.lang.String testValue,
java.util.List<java.lang.String> values) |
protected java.lang.String description
java.util.Set<java.lang.String> optionNames
protected java.lang.String name
protected boolean isRequired
protected java.lang.String furtherDetails
protected java.lang.String defaultValue
private java.net.URL basicURL
Option()
public Option(java.lang.String name, java.lang.String description)
public java.lang.String getName()
public void setName(java.lang.String name)
public void setBasicURL(java.net.URL url)
public java.net.URL getBasicURL()
public java.lang.String getDescription()
getDescription
in interface Argument<T>
public void setDescription(java.lang.String description)
public java.lang.String getFurtherDetails()
getFurtherDetails
in interface Argument<T>
java.net.MalformedURLException
public void setFurtherDetails(java.lang.String furtherDetails)
public java.lang.String getDefaultValue()
getDefaultValue
in interface Argument<T>
public void setDefaultValue(java.lang.String defaultVal) throws WrongParameterException
defaultVal
- WrongParameterException
- is thrown if the defaultValue is not found in optionListstatic boolean valueExist(java.lang.String testValue, java.util.List<java.lang.String> values)
public boolean isRequired()
public void setRequired(boolean isRequired)
public java.util.List<java.lang.String> getOptionNames()
public void setOptionNames(java.util.Set<java.lang.String> optionNames)
public java.util.Set<java.lang.String> addOptionNames(java.lang.String... value)
value
- public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toCommand(java.lang.String nameValueSeparator)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.util.List<java.lang.String> getPossibleValues()
getPossibleValues
in interface Argument<T>
public void setValue(java.lang.String dValue) throws WrongParameterException
Argument
setValue
in interface Argument<T>
dValue
- the value to be setWrongParameterException
- - when the value to be set is illegal. Wrong value for
numeric parameter is the value defined outside it , for
string type parameter, wrong value is the one which is not
listed in possible values listValueConstrain
void validate() throws javax.xml.bind.ValidationException
javax.xml.bind.ValidationException
- is the option is invalid. This happens if option does not
have a default value but have multiple option names, or no
option names is defined