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
public abstract class ArgHandlerFlag extends ArgHandler
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
Constructors Constructor Description ArgHandlerFlag()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddTagValue(java.lang.String tag, boolean value)abstract booleangetDefaultValue()Returns the default value that will appear in help messages.java.lang.StringgetHelpTag()The tag to display in help messages.java.lang.StringgetLabel()The root String that will be munged into -label and -nolabel variants for flag value toggling.java.lang.StringgetPurpose()abstract java.lang.StringgetPurposeSnippet()Returns a description that will be mixed together with default value to come up with the overall flag purpose.java.lang.StringgetTag()The primary tag matched by this argument handler.java.lang.String[]getTagArgs()A list of words representing the arguments in help text.java.lang.String[]getTags()The set of tags matched by this argument handler.(package private) booleangetValueByTag(java.lang.String tag)inthandle(java.lang.String[] args, int startIndex)Attempts to process one flag or "extra" command-line argument (that appears without a flag).booleanisRequired()abstract booleansetFlag(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
-
-
-
-
Method Detail
-
addTagValue
protected void addTagValue(java.lang.String tag, boolean value)
-
getDefaultValue
public abstract boolean getDefaultValue()
Returns the default value that will appear in help messages.
-
getHelpTag
public java.lang.String getHelpTag()
Description copied from class:ArgHandlerThe tag to display in help messages.- Overrides:
getHelpTagin classArgHandler
-
getLabel
public java.lang.String 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
public final java.lang.String getPurpose()
- Specified by:
getPurposein classArgHandler
-
getPurposeSnippet
public abstract java.lang.String getPurposeSnippet()
Returns a description that will be mixed together with default value to come up with the overall flag purpose.
-
getTag
public final java.lang.String getTag()
The primary tag matched by this argument handler.- Specified by:
getTagin 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
-
getTags
public final java.lang.String[] getTags()
Description copied from class:ArgHandlerThe 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:
getTagsin classArgHandler
-
getValueByTag
boolean getValueByTag(java.lang.String tag)
-
handle
public 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.
-
isRequired
public boolean isRequired()
- Overrides:
isRequiredin 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.
-
-