|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Parameter<T>
Interface for command line parameters.
Field Summary | |
---|---|
static boolean |
HIDDEN
when used as a value for the hidden indicator, indicates
that a parameter is hidden, and its description will not be listed
in the usage. |
static boolean |
MULTI_VALUED
when used as a value for the multiValued indicator,
specifies that an parameter accepts mulitiple values |
static boolean |
OPTIONAL
when used as a value for the optional indicator, specifies
that an parameter is optional |
static boolean |
PUBLIC
when used as a value for the hidden indicator, indicates
that a parameter is public, and its description will be listed in the
usage. |
static boolean |
REQUIRED
when used as a value for the optional indicator, specifies
that an parameter is required |
static boolean |
SINGLE_VALUED
when used as a value for the multiValued indicator,
specifies that a parameter accepts only one value |
Method Summary | |
---|---|
void |
addStringValue(java.lang.String value)
Adds the value, specified as a String. |
void |
addValue(T value)
Adds the specified Object as a value for this entity - the Object will be validated with respect to the constraints of the Parameter. |
java.util.List<T> |
getAcceptableValues()
Gets the values that are acceptable for this parameter, if a restricted set exists. |
java.lang.String |
getDesc()
gets the value of the parameter's description |
boolean |
getIgnoreRequired()
Gets the flag indicating that during parse, missing required Parameters are ignored if this Parameter is set. |
java.lang.String |
getOptionLabel()
gets the value of optionLabel |
java.lang.String |
getTag()
gets the value of tag |
T |
getValue()
The value of the parameter, in the case where the parameter is not multi-valued. |
java.util.List<T> |
getValues()
gets the values associated with this Parameter - the List will be in the order the values were listed on the command line. |
boolean |
isHidden()
gets the value of the hidden indicator |
boolean |
isMultiValued()
gets the value of multiValued indicator |
boolean |
isOptional()
returns the value of the optional indicator |
boolean |
isSet()
gets an indicator that the parameter's value has been set |
void |
setAcceptableValues(java.util.Collection<T> vals)
Sets the values that are acceptable for this parameter, if a restricted set exists. |
void |
setAcceptableValues(T[] vals)
Sets the values that are acceptable for this parameter, if a restricted set exists. |
void |
setDesc(java.lang.String desc)
sets the value of this parameter's description |
void |
setHidden(boolean hidden)
sets the value of the hidden indicator |
void |
setIgnoreRequired(boolean ignoreRequired)
Sets a flag such that during parse, missing required Parameters are ignored if this Parameter is set. |
void |
setMultiValued(boolean multiValued)
sets the value of the multiValued indicator |
void |
setOptional(boolean optional)
indicates whether or not the parameter is optional |
void |
setOptionLabel(java.lang.String optionLabel)
Sets the value of optionLabel. |
void |
setTag(java.lang.String tag)
sets the value of tag |
void |
setValue(T value)
Sets the value of the parameter to the specified string. |
void |
setValues(java.util.List<T> values)
Sets the values of the parameter to those specified. |
void |
setValues(T[] values)
Sets the values of the parameter to those specified. |
Field Detail |
---|
static final boolean HIDDEN
hidden
indicator, indicates
that a parameter is hidden, and its description will not be listed
in the usage.
static final boolean MULTI_VALUED
multiValued
indicator,
specifies that an parameter accepts mulitiple values
static final boolean OPTIONAL
optional
indicator, specifies
that an parameter is optional
static final boolean PUBLIC
hidden
indicator, indicates
that a parameter is public, and its description will be listed in the
usage.
static final boolean REQUIRED
optional
indicator, specifies
that an parameter is required
static final boolean SINGLE_VALUED
multiValued
indicator,
specifies that a parameter accepts only one value
Method Detail |
---|
void addStringValue(java.lang.String value) throws CmdLineException
value
- the value to be added
CmdLineException
- if the value of the entity has already been set and
multiValued
is not true
, or if the
value is not valid.void addValue(T value) throws CmdLineException
value
- the value to be added
CmdLineException
- if the value of the entity has already been set and
multiValued
is not true
, or if the
validation provided by the implementing class fails.java.util.List<T> getAcceptableValues()
java.lang.String getDesc()
boolean getIgnoreRequired()
true
if missing required Parameters will be ignored
when this Parameter is set.java.lang.String getOptionLabel()
java.lang.String getTag()
T getValue()
getValues()
java.util.List<T> getValues()
isSet()
boolean isHidden()
HIDDEN
) if the parameter is a hidden parameterboolean isMultiValued()
boolean isOptional()
boolean isSet()
void setAcceptableValues(java.util.Collection<T> vals)
vals
value, or an empty vals
Collection, will result in any previously set acceptable values being
cleared.
The toString()
values of the Objects in vals
will be used for the acceptable values.
vals
- the new acceptable valuesvoid setAcceptableValues(T[] vals)
vals
value, or an empty vals
array, will result in any previously set acceptable values being cleared.
vals
- the new acceptable valuesgetAcceptableValues()
void setDesc(java.lang.String desc) throws java.lang.IllegalArgumentException
desc
- a description of the parameter, suitable for display in the
command's usage
java.lang.IllegalArgumentException
- if desc
is fewer than 5 charaters.void setHidden(boolean hidden)
hidden
- true (HIDDEN
) if the parameter is a hidden parametervoid setIgnoreRequired(boolean ignoreRequired)
ignoreRequired
- set to true
to ignore missing required Parameters
if this Parameter is setgetIgnoreRequired()
void setMultiValued(boolean multiValued)
multiValued
- true if the parameter can have multiple valuesvoid setOptional(boolean optional)
optional
- true if the parameter is optionalvoid setOptionLabel(java.lang.String optionLabel)
st_date <mm/dd/yy> the start date of the reportThe default is the empty string.
optionLabel
- The string used as a label for the parameter's value. If null,
an empty string is used.getOptionLabel()
void setTag(java.lang.String tag) throws java.lang.IllegalArgumentException
tag
- a unique identifier for this parameter. If the parameter is
used as an option, it will be used to identify the option on
the command line. In the case where the parameter is used as
an argument, it will only be used to identify the argument in
the usage statement. Tags must be made up of any character but
'='.
java.lang.IllegalArgumentException
- if the length of tag
is less than 1, or
tag
contains an invalid character.void setValue(T value) throws CmdLineException
value
- the new value of the parameter
CmdLineException
- if the validation provided by the implementing class fails.void setValues(java.util.List<T> values) throws CmdLineException
values
- A List of objects to be used as the parameter's values.
CmdLineException
- if more than one value is specified and
multiValued
is not true
, or if the
validation provided by the implementing class fails.void setValues(T[] values) throws CmdLineException
values
- The objects to be used as the parameter's values.
CmdLineException
- if more than one value is specified and
multiValued
is not true
, or if the
validation provided by the implementing class fails.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |