|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjcmdline.AbstractParameter
jcmdline.IntParam
public class IntParam
Encapsulate a command line parameter whose value will be a signed integer in the same range as a java int.
CmdLineParser| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_OPTION_LABEL
the default label that will represent option values for this Parameter when displaying usage. |
protected int |
max
the maximum acceptable number - defaults to Integer.MAX_VALUE |
protected int |
min
the minimum acceptable number - defaults to Integer.MIN_VALUE |
| Fields inherited from class jcmdline.AbstractParameter |
|---|
acceptableValues, desc, hidden, ignoreRequired, multiValued, optional, optionLabel, set, tag, values |
| Fields inherited from interface jcmdline.Parameter |
|---|
HIDDEN, MULTI_VALUED, OPTIONAL, PUBLIC, REQUIRED, SINGLE_VALUED |
| Constructor Summary | |
|---|---|
IntParam(java.lang.String tag,
java.lang.String desc)
constructor - creates single-valued, optional, public parameter which will accept an integer between Integer.MIN_VALUE and Integer.MAX_VALUE. |
|
IntParam(java.lang.String tag,
java.lang.String desc,
boolean optional)
constructor - creates single-valued, public parameter which will accept an integer between Integer.MIN_VALUE and Integer.MAX_VALUE, and will be either optional or required, as specified. |
|
IntParam(java.lang.String tag,
java.lang.String desc,
boolean optional,
boolean multiValued)
constructor - creates a public parameter which will accept an integer between Integer.MIN_VALUE and Integer.MAX_VALUE, and will be either optional or required, and/or multi-valued, as specified. |
|
IntParam(java.lang.String tag,
java.lang.String desc,
boolean optional,
boolean multiValued,
boolean hidden)
constructor - creates a parameter which will accept an integer between Integer.MIN_VALUE and Integer.MAX_VALUE, and will be either optional or required, and/or multi-valued, as specified. |
|
IntParam(java.lang.String tag,
java.lang.String desc,
int[] acceptableValues)
constructor - creates a single-valued, optional, public, number parameter whose value must be one of the specified values. |
|
IntParam(java.lang.String tag,
java.lang.String desc,
int[] acceptableValues,
boolean optional)
constructor - creates a single-valued, public, number parameter whose value must be one of the specified values, and which is required or optional, as specified. |
|
IntParam(java.lang.String tag,
java.lang.String desc,
int[] acceptableValues,
boolean optional,
boolean multiValued)
constructor - creates a public number parameter whose value must be one of the specified values, and which is required or optional and/or multi-valued, as specified. |
|
IntParam(java.lang.String tag,
java.lang.String desc,
int[] acceptableValues,
boolean optional,
boolean multiValued,
boolean hidden)
constructor - creates a number parameter whose value must be one of the specified values, and all of whose other options are specified. |
|
IntParam(java.lang.String tag,
java.lang.String desc,
int min,
int max)
constructor - creates a single-valued, optional, public, parameter that will accept an integer between the specifed minimum and maximum values. |
|
IntParam(java.lang.String tag,
java.lang.String desc,
int min,
int max,
boolean optional)
constructor - creates a single-valued, public parameter that will accept an integer between the specifed minimum and maximum values, and which is required or optional, as specified. |
|
IntParam(java.lang.String tag,
java.lang.String desc,
int min,
int max,
boolean optional,
boolean multiValued)
constructor - creates a public parameter that will accept an integer between the specifed minimum and maximum values, and which is required or optional and/or multi-valued, as specified. |
|
IntParam(java.lang.String tag,
java.lang.String desc,
int min,
int max,
boolean optional,
boolean multiValued,
boolean hidden)
constructor - creates a parameter that will accept an integer between the specifed minimum and maximum values, and for which all other options are specified. |
|
| Method Summary | |
|---|---|
int[] |
getAcceptableIntValues()
gets the acceptable values for this parameter |
int |
getMax()
gets the maximum acceptable value for the parameter |
int |
getMin()
gets minimum acceptable value for the parameter's value |
int |
intValue()
Gets the value of the IntParam as in int. |
int[] |
intValues()
Gets the values of the IntParam as an int array. |
void |
setAcceptableIntValues(int[] intValues)
Sets the acceptable values for this parameter. |
void |
setMax(int max)
Sets the maximum acceptable value for the parameter. |
void |
setMin(int min)
Sets the minimum acceptable value for the parameter's value. |
void |
validateValue(java.lang.String val)
Validates a prospective value with regards to the minimum and maximum values and the acceptableValues called by add/setValue(s)(). |
| Methods inherited from class jcmdline.AbstractParameter |
|---|
addValue, getAcceptableValues, getDesc, getIgnoreRequired, getOptionLabel, getTag, getValue, getValues, isHidden, isMultiValued, isOptional, isSet, setAcceptableValues, setAcceptableValues, setDesc, setHidden, setIgnoreRequired, setMultiValued, setOptional, setOptionLabel, setTag, setValue, setValues, setValues |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_OPTION_LABEL
count <n> Specifies the maximum number of files to be
produced by this program.
setOptionLabel(),
"IntParam.defaultOptionLabel in 'strings' properties file"protected int max
protected int min
| Constructor Detail |
|---|
public IntParam(java.lang.String tag,
java.lang.String desc)
tag - a unique identifier for this parameterdesc - a description of the parameter, suitable for display
in a usage statement
java.lang.IllegalArgumentException - if tag
or setTag(),
setDesc()
public IntParam(java.lang.String tag,
java.lang.String desc,
boolean optional)
tag - a unique identifier for this parameterdesc - a description of the parameter, suitable for display
in a usage statementoptional - OPTIONAL if
optional,
REQUIRED if required
java.lang.IllegalArgumentException - if any of the specified
parameters are invalid.setTag(),
setDesc()
public IntParam(java.lang.String tag,
java.lang.String desc,
boolean optional,
boolean multiValued)
tag - a unique identifier for this parameterdesc - a description of the parameter, suitable for display
in a usage statementoptional - OPTIONAL if
optional,
REQUIRED if requiredmultiValued - MULTI_VALUED if
the parameter can accept multiple values,
SINGLE_VALUED
if the parameter can contain only a single value
java.lang.IllegalArgumentException - if any of the specified
parameters are invalid.setTag(),
setDesc(),
SINGLE_VALUED,
MULTI_VALUED
public IntParam(java.lang.String tag,
java.lang.String desc,
boolean optional,
boolean multiValued,
boolean hidden)
tag - a unique identifier for this parameterdesc - a description of the parameter, suitable for display
in a usage statementoptional - OPTIONAL if
optional,
REQUIRED if requiredmultiValued - MULTI_VALUED if
the parameter can accept multiple values,
SINGLE_VALUED
if the parameter can contain only a single valuehidden - HIDDEN if parameter is
not to be listed in the usage,
PUBLIC otherwise.
java.lang.IllegalArgumentException - if any of the specified
parameters are invalid.setTag(),
setDesc(),
SINGLE_VALUED,
MULTI_VALUED,
HIDDEN,
PUBLIC
public IntParam(java.lang.String tag,
java.lang.String desc,
int min,
int max)
tag - a unique identifier for this parameterdesc - a description of the parameter, suitable for display
in a usage statementmin - the minimum acceptable valuemax - the maximum acceptable value
java.lang.IllegalArgumentException - if any parameter is
invalid.setTag(),
setDesc(),
setMin(),
setMax()
public IntParam(java.lang.String tag,
java.lang.String desc,
int min,
int max,
boolean optional)
tag - a unique identifier for this parameterdesc - a description of the parameter, suitable for display
in a usage statementmin - the minimum acceptable valuemax - the maximum acceptable valueoptional - OPTIONAL if
optional,
REQUIRED if required
java.lang.IllegalArgumentException - if any parameter is
invalid.setTag(),
setDesc(),
setMin(),
setMax(),
OPTIONAL,
REQUIRED
public IntParam(java.lang.String tag,
java.lang.String desc,
int min,
int max,
boolean optional,
boolean multiValued)
tag - a unique identifier for this parameterdesc - a description of the parameter, suitable for display
in a usage statementmin - the minimum acceptable valuemax - the maximum acceptable valueoptional - OPTIONAL if
optional,
REQUIRED if requiredmultiValued - MULTI_VALUED if
the parameter can accept multiple values,
SINGLE_VALUED
if the parameter can contain only a single value
java.lang.IllegalArgumentException - if any parameter is
invalid.setTag(),
setDesc(),
setMin(),
setMax(),
OPTIONAL,
REQUIRED,
SINGLE_VALUED,
MULTI_VALUED
public IntParam(java.lang.String tag,
java.lang.String desc,
int min,
int max,
boolean optional,
boolean multiValued,
boolean hidden)
tag - a unique identifier for this parameterdesc - a description of the parameter, suitable for display
in a usage statementmin - the minimum acceptable valuemax - the maximum acceptable valueoptional - OPTIONAL if
optional,
REQUIRED if requiredmultiValued - MULTI_VALUED if
the parameter can accept multiple values,
SINGLE_VALUED
if the parameter can contain only a single valuehidden - HIDDEN if parameter is
not to be listed in the usage,
PUBLIC otherwise.
java.lang.IllegalArgumentException - if any parameter is
invalid.setTag(),
setDesc(),
setMin(),
setMax(),
OPTIONAL,
REQUIRED,
SINGLE_VALUED,
MULTI_VALUED,
HIDDEN,
PUBLIC
public IntParam(java.lang.String tag,
java.lang.String desc,
int[] acceptableValues)
tag - the tag associated with this parameterdesc - a description of the parameter, suitable for display
in a usage statementacceptableValues - the acceptable values for the parameter
java.lang.IllegalArgumentException - if any parameter is
invalid.setTag(),
setDesc(),
setAcceptableIntValues()
public IntParam(java.lang.String tag,
java.lang.String desc,
int[] acceptableValues,
boolean optional)
tag - the tag associated with this parameterdesc - a description of the parameter, suitable for display
in a usage statementacceptableValues - the acceptable values for the parameteroptional - OPTIONAL if
optional,
REQUIRED if required
java.lang.IllegalArgumentException - if any parameter is
invalid.setTag(),
setDesc(),
setAcceptableIntValues(),
OPTIONAL,
REQUIRED
public IntParam(java.lang.String tag,
java.lang.String desc,
int[] acceptableValues,
boolean optional,
boolean multiValued)
tag - the tag associated with this parameterdesc - a description of the parameter, suitable for display
in a usage statementacceptableValues - the acceptable values for the parameteroptional - OPTIONAL if
optional,
REQUIRED if requiredmultiValued - MULTI_VALUED if
the parameter can accept multiple values,
SINGLE_VALUED
if the parameter can contain only a single value
java.lang.IllegalArgumentException - if any parameter is
invalid.setTag(),
setDesc(),
setAcceptableIntValues(),
OPTIONAL,
REQUIRED,
SINGLE_VALUED,
MULTI_VALUED
public IntParam(java.lang.String tag,
java.lang.String desc,
int[] acceptableValues,
boolean optional,
boolean multiValued,
boolean hidden)
tag - the tag associated with this parameterdesc - a description of the parameter, suitable for display
in a usage statementacceptableValues - the acceptable values for the parameteroptional - OPTIONAL if
optional,
REQUIRED if requiredmultiValued - MULTI_VALUED if
the parameter can accept multiple values,
SINGLE_VALUED
if the parameter can contain only a single valuehidden - HIDDEN if parameter is
not to be listed in the usage,
PUBLIC otherwise.
java.lang.IllegalArgumentException - if any parameter is
invalid.setTag(),
setDesc(),
setAcceptableIntValues(),
OPTIONAL,
REQUIRED,
SINGLE_VALUED,
MULTI_VALUED,
HIDDEN,
PUBLIC| Method Detail |
|---|
public void setMin(int min)
If both acceptableValues and/or a minimum or maximum
limit for the parameter value are specified, a valid value must
satisfy all of the constraints.
min - the minimum acceptable value
java.lang.IllegalArgumentException - if min is
greater than maxpublic int intValue()
java.lang.RuntimeException - if the value of the IntParam
has not been set.Parameter.isSet()public int[] intValues()
Parameter.isSet()public int getMin()
public void setMax(int max)
If both acceptableValues and/or a minimum or maximum
limit for the parameter value are specified, a valid value must
satisfy all of the constraints.
max - the maximum acceptable value
java.lang.IllegalArgumentException - if min is
greater than maxpublic int getMax()
public void setAcceptableIntValues(int[] intValues)
If both acceptableValues and/or a minimum or maximum
limit for the parameter value are specified, a valid value must
satisfy all of the constraints.
acceptableValues - An array of acceptable int values that
the parameter's values must match. If null,
the parameter's values can be any int.public int[] getAcceptableIntValues()
public void validateValue(java.lang.String val)
throws CmdLineException
validateValue in interface ParametervalidateValue in class AbstractParameterval - the prospective value to validate
CmdLineException - if
value is not valid with regard to
# the minimum and
maximum values, and the acceptableValues.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||