Class Arguments
This class provides useful shortcuts and constants.
They are mainly used to specify parameter to Argument
object.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FeatureControl
The value ofFeatureControl.SUPPRESS
. -
Method Summary
Modifier and TypeMethodDescriptionstatic AppendArgumentAction
append()
Returns append action.static AppendConstArgumentAction
Returns appendConst action.static CountArgumentAction
count()
Returns count action.static <T extends Enum<T>>
EnumArgumentType<T>ReturnsEnumArgumentType
with given enumtype
.static FileArgumentType
fileType()
Returns newFileArgumentType
object.static HelpArgumentAction
help()
Returns help action.static <T extends Comparable<T>>
RangeArgumentChoice<T>range
(T min, T max) Creates new range constrained choice.static StoreArgumentAction
store()
Returns store action.static StoreConstArgumentAction
Returns storeConst action.static StoreFalseArgumentAction
Returns storeFalse action.static StoreTrueArgumentAction
Returns storeTrue action.static VersionArgumentAction
version()
Returns version action.
-
Field Details
-
SUPPRESS
The value of
FeatureControl.SUPPRESS
.If value is used with
Argument.setDefault(FeatureControl)
, no attribute is added if the command line argument was not present. Otherwise, the default value, which defaults to null, will be added to the object, regardless of the presence of command line argument, returned byArgumentParser.parseArgs(String[])
.
-
-
Method Details
-
range
Creates new range constrained choice.
The value specified in command line will be checked to see whether it fits in given range [min, max], inclusive.
- Parameters:
min
- The lowerbound of the range, inclusive.max
- The upperbound of the range, inclusive.- Returns:
RangeArgumentChoice
object.
-
store
Returns store action.- Returns:
StoreArgumentAction
object.
-
storeTrue
Returns storeTrue action.
If this action is used, the value specified using
Argument.nargs(int)
will be ignored.- Returns:
StoreTrueArgumentAction
object.
-
storeFalse
Returns storeFalse action.
If this action is used, the value specified using
Argument.nargs(int)
will be ignored.- Returns:
StoreFalseArgumentAction
object.
-
storeConst
Returns storeConst action.
If this action is used, the value specified using
Argument.nargs(int)
will be ignored.- Returns:
StoreConstArgumentAction
object.
-
append
Returns append action.
If this action is used, the attribute will be of type
List
. If used withArgument.nargs(int)
, the element of List will be List. This is becauseArgument.nargs(int)
produces List.- Returns:
AppendArgumentAction
object.
-
appendConst
Returns appendConst action.
If this action is used, the value specified using
Argument.nargs(int)
will be ignored.- Returns:
AppendConstArgumentAction
object.
-
help
Returns help action.
This is used for an option printing help message. Please note that this action terminates program after printing help message.
- Returns:
HelpArgumentAction
object.
-
version
Returns version action.
This is used for an option printing version message. Please note that this action terminates program after printing version message.
- Returns:
VersionArgumentAction
object.
-
count
Returns count action.
This action counts the number of occurrence of the option. This action does not consume argument.
- Returns:
CountArgumentAction
object.
-
enumType
Returns
EnumArgumentType
with given enumtype
.Since enum does not have a constructor with string argument, you cannot use
Argument.type(Class)
. Instead use this convenient function.- Parameters:
type
- The enum type- Returns:
EnumArgumentType
object
-
fileType
Returns new
FileArgumentType
object.- Returns:
FileArgumentType
object
-