Package com.google.gwt.util.tools
Class ArgHandlerFlag
java.lang.Object
com.google.gwt.util.tools.ArgHandler
com.google.gwt.util.tools.ArgHandlerFlag
- Direct Known Subclasses:
ArgHandlerIgnore
,ArgHandlerOverwrite
Argument handler for boolean flags that have no parameters.
Supports toggling the boolean value on and off using -label and -nolabel tag variants and
calculating a meaningful purpose including default value.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addTagValue
(String tag, boolean value) abstract boolean
Returns the default value that will appear in help messages.The tag to display in help messages.getLabel()
The root String that will be munged into -label and -nolabel variants for flag value toggling.final String
abstract String
Returns a description that will be mixed together with default value to come up with the overall flag purpose.final String
getTag()
The primary tag matched by this argument handler.String[]
A list of words representing the arguments in help text.final String[]
getTags()
The set of tags matched by this argument handler.(package private) boolean
getValueByTag
(String tag) int
Attempts to process one flag or "extra" command-line argument (that appears without a flag).boolean
abstract boolean
setFlag
(boolean value) Takes the explicitly provided value and propagates it into whatever option settings this flag controls.Methods inherited from class com.google.gwt.util.tools.ArgHandler
getDefaultArgs, isExperimental, isUndocumented
-
Constructor Details
-
ArgHandlerFlag
public ArgHandlerFlag()
-
-
Method Details
-
addTagValue
-
getDefaultValue
public abstract boolean getDefaultValue()Returns the default value that will appear in help messages. -
getHelpTag
Description copied from class:ArgHandler
The tag to display in help messages.- Overrides:
getHelpTag
in classArgHandler
-
getLabel
The root String that will be munged into -label and -nolabel variants for flag value toggling. Should follow the verb[Adjective]Noun naming pattern. For example: -
getPurpose
- Specified by:
getPurpose
in classArgHandler
-
getPurposeSnippet
Returns a description that will be mixed together with default value to come up with the overall flag purpose. -
getTag
The primary tag matched by this argument handler.- Specified by:
getTag
in classArgHandler
-
getTagArgs
Description copied from class:ArgHandler
A list of words representing the arguments in help text.- Specified by:
getTagArgs
in classArgHandler
-
getTags
Description copied from class:ArgHandler
The set of tags matched by this argument handler. By default includes just the one primary tag mentioned in getTag() but can be overridden to provide broader matching.- Overrides:
getTags
in classArgHandler
-
getValueByTag
-
handle
Description copied from class:ArgHandler
Attempts to process one flag or "extra" command-line argument (that appears without a flag).- Specified by:
handle
in 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.
-
isRequired
public boolean isRequired()- Overrides:
isRequired
in classArgHandler
-
setFlag
public abstract boolean setFlag(boolean value) Takes the explicitly provided value and propagates it into whatever option settings this flag controls.- Parameters:
value
- the new value for the flag.- Returns:
- whether the assignment was valid.
-