Class Arguments
- java.lang.Object
-
- net.sourceforge.argparse4j.impl.Arguments
-
public final class Arguments extends java.lang.ObjectThis class provides useful shortcuts and constants.
They are mainly used to specify parameter to
Argumentobject.
-
-
Field Summary
Fields Modifier and Type Field Description static FeatureControlSUPPRESSThe value ofFeatureControl.SUPPRESS.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AppendArgumentActionappend()Returns append action.static AppendConstArgumentActionappendConst()Returns appendConst action.static CountArgumentActioncount()Returns count action.static <T extends java.lang.Enum<T>>
EnumArgumentType<T>enumType(java.lang.Class<T> type)ReturnsEnumArgumentTypewith given enumtype.static FileArgumentTypefileType()Returns newFileArgumentTypeobject.static HelpArgumentActionhelp()Returns help action.static <T extends java.lang.Comparable<T>>
RangeArgumentChoice<T>range(T min, T max)Creates new range constrained choice.static StoreArgumentActionstore()Returns store action.static StoreConstArgumentActionstoreConst()Returns storeConst action.static StoreFalseArgumentActionstoreFalse()Returns storeFalse action.static StoreTrueArgumentActionstoreTrue()Returns storeTrue action.static VersionArgumentActionversion()Returns version action.
-
-
-
Field Detail
-
SUPPRESS
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 byArgumentParser.parseArgs(String[]).
-
-
Method Detail
-
range
public static <T extends java.lang.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.
- Parameters:
min- The lowerbound of the range, inclusive.max- The upperbound of the range, inclusive.- Returns:
RangeArgumentChoiceobject.
-
store
public static StoreArgumentAction store()
Returns store action.- Returns:
StoreArgumentActionobject.
-
storeTrue
public static StoreTrueArgumentAction storeTrue()
Returns storeTrue action.
If this action is used, the value specified using
Argument.nargs(int)will be ignored.- Returns:
StoreTrueArgumentActionobject.
-
storeFalse
public static StoreFalseArgumentAction storeFalse()
Returns storeFalse action.
If this action is used, the value specified using
Argument.nargs(int)will be ignored.- Returns:
StoreFalseArgumentActionobject.
-
storeConst
public static StoreConstArgumentAction storeConst()
Returns storeConst action.
If this action is used, the value specified using
Argument.nargs(int)will be ignored.- Returns:
StoreConstArgumentActionobject.
-
append
public static AppendArgumentAction 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
public static AppendConstArgumentAction appendConst()
Returns appendConst action.
If this action is used, the value specified using
Argument.nargs(int)will be ignored.- Returns:
AppendConstArgumentActionobject.
-
help
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.
- Returns:
HelpArgumentActionobject.
-
version
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.
- Returns:
VersionArgumentActionobject.
-
count
public static CountArgumentAction count()
Returns count action.
This action counts the number of occurrence of the option. This action does not consume argument.
- Returns:
CountArgumentActionobject.
-
enumType
public static <T extends java.lang.Enum<T>> EnumArgumentType<T> enumType(java.lang.Class<T> type)
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.- Parameters:
type- The enum type- Returns:
EnumArgumentTypeobject
-
fileType
public static FileArgumentType fileType()
Returns new
FileArgumentTypeobject.- Returns:
FileArgumentTypeobject
-
-