Package com.google.gwt.util.tools
Class ArgHandlerEnum<T extends java.lang.Enum<T>>
- java.lang.Object
-
- com.google.gwt.util.tools.ArgHandler
-
- com.google.gwt.util.tools.ArgHandlerEnum<T>
-
- Type Parameters:
T- enum type providing option values.
public abstract class ArgHandlerEnum<T extends java.lang.Enum<T>> extends ArgHandler
A generic arg handler for options defined by enums.
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.String[]getDefaultArgs()protected java.lang.StringgetPurposeString(java.lang.String prefix)java.lang.String[]getTagArgs()A list of words representing the arguments in help text.inthandle(java.lang.String[] args, int startIndex)Attempts to process one flag or "extra" command-line argument (that appears without a flag).abstract voidsetValue(T value)Override to handle the setting of an enum value.-
Methods inherited from class com.google.gwt.util.tools.ArgHandler
getHelpTag, getPurpose, getTag, getTags, isExperimental, isRequired, isUndocumented
-
-
-
-
Constructor Detail
-
ArgHandlerEnum
public ArgHandlerEnum(java.lang.Class<T> optionsEnumClass)
Constructor, default value must be handled by the user code.
-
ArgHandlerEnum
public ArgHandlerEnum(java.lang.Class<T> optionsEnumClass, @Nullable T defaultValue, boolean allowAbbreviation)
Constructor, allows to specify the default value for the option and whether to accept or prefixes as abbreviations.When
defaultValueis null, handling of the default for the option is left to be handled by the user code.
-
-
Method Detail
-
getDefaultArgs
public java.lang.String[] getDefaultArgs()
- Overrides:
getDefaultArgsin classArgHandler
-
getTagArgs
public java.lang.String[] getTagArgs()
Description copied from class:ArgHandlerA list of words representing the arguments in help text.- Specified by:
getTagArgsin classArgHandler
-
handle
public final int handle(java.lang.String[] args, int startIndex)Description copied from class:ArgHandlerAttempts to process one flag or "extra" command-line argument (that appears without a flag).- Specified by:
handlein classArgHandler- Parameters:
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.- Returns:
- the number of additional arguments consumed, not including the flag or extra argument. Alternately, returns -1 if the argument cannot be used. This will causes the program to abort and usage to be displayed.
-
getPurposeString
protected java.lang.String getPurposeString(java.lang.String prefix)
-
setValue
public abstract void setValue(T value)
Override to handle the setting of an enum value.
-
-