Modifier and Type | Field and Description |
---|---|
static FeatureControl |
SUPPRESS
The value of
FeatureControl.SUPPRESS . |
Modifier and Type | Method and Description |
---|---|
static AppendArgumentAction |
append()
Returns append action.
|
static AppendConstArgumentAction |
appendConst()
Returns appendConst action.
|
static BooleanArgumentType |
booleanType()
Returns
BooleanArgumentType with "true" as true value, and
"false" as false value. |
static BooleanArgumentType |
booleanType(String trueValue,
String falseValue)
Returns
BooleanArgumentType with given true/false values. |
static <T extends Enum<T>> |
caseInsensitiveEnumStringType(Class<T> type)
Returns
CaseInsensitiveEnumStringArgumentType with given enum
type . |
static <T extends Enum<T>> |
caseInsensitiveEnumType(Class<T> type)
Returns
CaseInsensitiveEnumNameArgumentType with given enum
type . |
static CountArgumentAction |
count()
Returns count action.
|
static <T extends Enum<T>> |
enumStringType(Class<T> type)
Returns
EnumStringArgumentType with given enum type . |
static <T extends Enum<T>> |
enumType(Class<T> type)
Deprecated.
|
static FileArgumentType |
fileType()
Returns new
FileArgumentType object. |
static HelpArgumentAction |
help()
Returns help action.
|
static <T extends Comparable<T>> |
range(T min,
T max)
Creates new range constrained choice.
|
static StoreArgumentAction |
store()
Returns store action.
|
static StoreConstArgumentAction |
storeConst()
Returns storeConst action.
|
static StoreFalseArgumentAction |
storeFalse()
Returns storeFalse action.
|
static StoreTrueArgumentAction |
storeTrue()
Returns storeTrue action.
|
static VersionArgumentAction |
version()
Returns version action.
|
public static final FeatureControl 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
by ArgumentParser.parseArgs(String[])
.
public static <T extends Comparable<T>> RangeArgumentChoice<T> range(T min, T max)
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.
min
- The lower bound of the range, inclusive.max
- The upper bound of the range, inclusive.RangeArgumentChoice
object.public static StoreArgumentAction store()
StoreArgumentAction
object.public static StoreTrueArgumentAction storeTrue()
Returns storeTrue action.
If this action is used, the value specified using
Argument.nargs(int)
will be ignored.
StoreTrueArgumentAction
object.public static StoreFalseArgumentAction storeFalse()
Returns storeFalse action.
If this action is used, the value specified using
Argument.nargs(int)
will be ignored.
StoreFalseArgumentAction
object.public static StoreConstArgumentAction storeConst()
Returns storeConst action.
If this action is used, the value specified using
Argument.nargs(int)
will be ignored.
StoreConstArgumentAction
object.public static AppendArgumentAction append()
Returns append action.
If this action is used, the attribute will be of type List
. If
used with Argument.nargs(int)
, the element of List will be List.
This is because Argument.nargs(int)
produces List.
AppendArgumentAction
object.public static AppendConstArgumentAction appendConst()
Returns appendConst action.
If this action is used, the value specified using
Argument.nargs(int)
will be ignored.
AppendConstArgumentAction
object.public static HelpArgumentAction help()
Returns help action.
This is used for an option printing help message. Please note that this action terminates program after printing help message.
HelpArgumentAction
object.public static VersionArgumentAction version()
Returns version action.
This is used for an option printing version message. Please note that this action terminates program after printing version message.
VersionArgumentAction
object.public static CountArgumentAction count()
Returns count action.
This action counts the number of occurrence of the option. This action does not consume argument.
CountArgumentAction
object.@Deprecated public static <T extends Enum<T>> EnumArgumentType<T> enumType(Class<T> type)
Returns EnumArgumentType
with given enum type
.
Since enum does not have a constructor with string argument, you cannot
use Argument.type(Class)
. Instead use this convenient function.
type
- The enum typeEnumArgumentType
objectpublic static FileArgumentType fileType()
Returns new FileArgumentType
object.
FileArgumentType
objectpublic static <T extends Enum<T>> EnumStringArgumentType<T> enumStringType(Class<T> type)
Returns EnumStringArgumentType
with given enum type
.
Uses Enum.toString()
instead of Enum.name()
as the String
representation of the enum. For enums that do not override
Enum.toString()
, this behaves the same as
ReflectArgumentType
or just use Argument.type(Class)
.
type
- The enum typeEnumStringArgumentType
objectpublic static <T extends Enum<T>> CaseInsensitiveEnumNameArgumentType<T> caseInsensitiveEnumType(Class<T> type)
Returns CaseInsensitiveEnumNameArgumentType
with given enum
type
.
Uses Enum.name()
as the String representation of the enum.
type
- The enum typeCaseInsensitiveEnumNameArgumentType
objectpublic static <T extends Enum<T>> CaseInsensitiveEnumStringArgumentType<T> caseInsensitiveEnumStringType(Class<T> type)
Returns CaseInsensitiveEnumStringArgumentType
with given enum
type
.
Uses Enum.toString()
instead of Enum.name()
as the String
representation of the enum. For enums that do not override
Enum.toString()
, this behaves the same as
CaseInsensitiveEnumNameArgumentType
.
type
- The enum typeCaseInsensitiveEnumStringArgumentType
objectpublic static BooleanArgumentType booleanType()
Returns BooleanArgumentType
with "true" as true value, and
"false" as false value.
Read BooleanArgumentType
documentation to know the difference
between the use of BooleanArgumentType
and passing
Boolean
class to Argument.type(Class)
.
public static BooleanArgumentType booleanType(String trueValue, String falseValue)
Returns BooleanArgumentType
with given true/false values.
Read BooleanArgumentType
documentation to know the difference
between the use of BooleanArgumentType
and passing
Boolean
class to Argument.type(Class)
.
trueValue
- string used as true valuefalseValue
- string used as false valueCopyright © 2012–2017. All rights reserved.