T
- enum type providing option values.public abstract class ArgHandlerEnum<T extends java.lang.Enum<T>> extends ArgHandler
Constructor and Description |
---|
ArgHandlerEnum(java.lang.Class<T> optionsEnumClass)
Constructor, default value must be handled by the user code.
|
ArgHandlerEnum(java.lang.Class<T> optionsEnumClass,
T defaultValue,
boolean allowAbbreviation)
Constructor, allows to specify the default value for the option and whether to accept or
prefixes as abbreviations.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getDefaultArgs() |
protected java.lang.String |
getPurposeString(java.lang.String prefix) |
java.lang.String[] |
getTagArgs()
A list of words representing the arguments in help text.
|
int |
handle(java.lang.String[] args,
int startIndex)
Attempts to process one flag or "extra" command-line argument (that appears
without a flag).
|
abstract void |
setValue(T value)
Override to handle the setting of an enum value.
|
getHelpTag, getPurpose, getTag, getTags, isExperimental, isRequired, isUndocumented
public ArgHandlerEnum(java.lang.Class<T> optionsEnumClass)
public ArgHandlerEnum(java.lang.Class<T> optionsEnumClass, @Nullable T defaultValue, boolean allowAbbreviation)
When defaultValue
is null, handling of the default for the option is left to be
handled by the user code.
public java.lang.String[] getDefaultArgs()
getDefaultArgs
in class ArgHandler
public java.lang.String[] getTagArgs()
ArgHandler
getTagArgs
in class ArgHandler
public final int handle(java.lang.String[] args, int startIndex)
ArgHandler
handle
in class ArgHandler
args
- the arguments passed in to main()startIndex
- an index into args indicating the first argument to use.
If this is a handler for a flag argument. Otherwise it's the index of the
"extra" argument.protected java.lang.String getPurposeString(java.lang.String prefix)
public abstract void setValue(T value)