Class Arguments
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final AppendArgumentActionprivate static final AppendConstArgumentActionprivate static final CountArgumentActionprivate static final HelpArgumentActionprivate static final StoreArgumentActionprivate static final StoreConstArgumentActionprivate static final StoreFalseArgumentActionprivate static final StoreTrueArgumentActionstatic final FeatureControlThe value ofFeatureControl.SUPPRESS.private static final VersionArgumentAction -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateIntentionally made private to avoid instantiation in application code. -
Method Summary
Modifier and TypeMethodDescriptionstatic AppendArgumentActionappend()Returns append action.static AppendConstArgumentActionReturns appendConst action.static BooleanArgumentTypeReturnsBooleanArgumentTypewith "true" as true value, and "false" as false value.static BooleanArgumentTypebooleanType(String trueValue, String falseValue) ReturnsBooleanArgumentTypewith given true/false values.static <T extends Enum<T>>
CaseInsensitiveEnumStringArgumentType<T> caseInsensitiveEnumStringType(Class<T> type) ReturnsCaseInsensitiveEnumStringArgumentTypewith given enumtype.static <T extends Enum<T>>
CaseInsensitiveEnumNameArgumentType<T> caseInsensitiveEnumType(Class<T> type) ReturnsCaseInsensitiveEnumNameArgumentTypewith given enumtype.static CountArgumentActioncount()Returns count action.static <T extends Enum<T>>
EnumStringArgumentType<T> enumStringType(Class<T> type) ReturnsEnumStringArgumentTypewith given enumtype.static <T extends Enum<T>>
EnumArgumentType<T> Deprecated.static FileArgumentTypefileType()Returns newFileArgumentTypeobject.static HelpArgumentActionhelp()Returns help action.static <T extends Comparable<T>>
RangeArgumentChoice<T> range(T min, T max) Creates new range constrained choice.static StoreArgumentActionstore()Returns store action.static StoreConstArgumentActionReturns storeConst action.static StoreFalseArgumentActionReturns storeFalse action.static StoreTrueArgumentActionReturns storeTrue action.static VersionArgumentActionversion()Returns version action.
-
Field Details
-
store_
-
storeTrue_
-
storeFalse_
-
storeConst_
-
append_
-
appendConst_
-
help_
-
version_
-
count_
-
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[]).
-
-
Constructor Details
-
Arguments
private Arguments()Intentionally made private to avoid instantiation in application code.
-
-
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.
- Type Parameters:
T- The type of the values in the range- Parameters:
min- The lower bound of the range, inclusive.max- The upper bound of the range, inclusive.- Returns:
RangeArgumentChoiceobject.
-
store
Returns store action.- Returns:
StoreArgumentActionobject.
-
storeTrue
Returns storeTrue action.
If this action is used, the value specified using
Argument.nargs(int)will be ignored.- Returns:
StoreTrueArgumentActionobject.
-
storeFalse
Returns storeFalse action.
If this action is used, the value specified using
Argument.nargs(int)will be ignored.- Returns:
StoreFalseArgumentActionobject.
-
storeConst
Returns storeConst action.
If this action is used, the value specified using
Argument.nargs(int)will be ignored.- Returns:
StoreConstArgumentActionobject.
-
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:
AppendArgumentActionobject.
-
appendConst
Returns appendConst action.
If this action is used, the value specified using
Argument.nargs(int)will be ignored.- Returns:
AppendConstArgumentActionobject.
-
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:
HelpArgumentActionobject.
-
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:
VersionArgumentActionobject.
-
count
Returns count action.
This action counts the number of occurrence of the option. This action does not consume argument.
- Returns:
CountArgumentActionobject.
-
enumType
Deprecated.Returns
EnumArgumentTypewith given enumtype.Since enum does not have a constructor with string argument, you cannot use
Argument.type(Class). Instead use this convenient function.- Type Parameters:
T- The type of the enum- Parameters:
type- The enum type- Returns:
EnumArgumentTypeobject
-
fileType
Returns new
FileArgumentTypeobject.- Returns:
FileArgumentTypeobject
-
enumStringType
Returns
EnumStringArgumentTypewith given enumtype.Uses
Enum.toString()instead ofEnum.name()as the String representation of the enum. For enums that do not overrideEnum.toString(), this behaves the same asReflectArgumentTypeor just useArgument.type(Class).- Type Parameters:
T- The type of the enum- Parameters:
type- The enum type- Returns:
EnumStringArgumentTypeobject
-
caseInsensitiveEnumType
public static <T extends Enum<T>> CaseInsensitiveEnumNameArgumentType<T> caseInsensitiveEnumType(Class<T> type) Returns
CaseInsensitiveEnumNameArgumentTypewith given enumtype.Uses
Enum.name()as the String representation of the enum.- Type Parameters:
T- The type of the enum- Parameters:
type- The enum type- Returns:
CaseInsensitiveEnumNameArgumentTypeobject- Since:
- 0.8.0
-
caseInsensitiveEnumStringType
public static <T extends Enum<T>> CaseInsensitiveEnumStringArgumentType<T> caseInsensitiveEnumStringType(Class<T> type) Returns
CaseInsensitiveEnumStringArgumentTypewith given enumtype.Uses
Enum.toString()instead ofEnum.name()as the String representation of the enum. For enums that do not overrideEnum.toString(), this behaves the same asCaseInsensitiveEnumNameArgumentType.- Type Parameters:
T- The type of the enum- Parameters:
type- The enum type- Returns:
CaseInsensitiveEnumStringArgumentTypeobject- Since:
- 0.8.0
-
booleanType
Returns
BooleanArgumentTypewith "true" as true value, and "false" as false value.Read
BooleanArgumentTypedocumentation to know the difference between the use ofBooleanArgumentTypeand passingBooleanclass toArgument.type(Class).- Returns:
- The BooleanArgumentType object
- Since:
- 0.7.0
-
booleanType
Returns
BooleanArgumentTypewith given true/false values.Read
BooleanArgumentTypedocumentation to know the difference between the use ofBooleanArgumentTypeand passingBooleanclass toArgument.type(Class).- Parameters:
trueValue- string used as true valuefalseValue- string used as false value- Returns:
- The BooleanArgumentType object
- Since:
- 0.7.0
-