public class Flag extends BaseOption
Option, but without any value argument. Can only
toggle boolean values.| Constructor and Description |
|---|
Flag(String name,
String shortNames,
String usage,
Consumer<Boolean> setter) |
Flag(String name,
String shortNames,
String usage,
Consumer<Boolean> setter,
Boolean defaultValue) |
Flag(String name,
String shortNames,
String usage,
Consumer<Boolean> setter,
Boolean defaultValue,
boolean hidden) |
Flag(String name,
String shortNames,
String usage,
Consumer<Boolean> setter,
Boolean defaultValue,
String negateName) |
Flag(String name,
String shortNames,
String usage,
Consumer<Boolean> setter,
Boolean defaultValue,
String negateName,
boolean hidden) |
| Modifier and Type | Method and Description |
|---|---|
int |
apply(ArgumentList args)
Parse the argument list, including the argument string that triggered
the call.
|
int |
applyShort(String opts,
ArgumentList args)
When handling a list of short options, except for the last short
option.
|
String |
getNegateName()
The alternative (negating) long name for the flag.
|
String |
getSingleLineUsage()
Get the argument's single line usage string.
|
void |
validate()
Called on all the arguments after the parsing is done to validate
if all requirements have been passed.
|
getMetaVar, getPrefix, getShortNames, nameOrShortgetDefaultValue, getName, getUsage, isHidden, isRepeated, isRequiredpublic static final String NEGATE
public Flag(String name, String shortNames, String usage, Consumer<Boolean> setter, Boolean defaultValue)
public Flag(String name, String shortNames, String usage, Consumer<Boolean> setter, Boolean defaultValue, String negateName)
public Flag(String name, String shortNames, String usage, Consumer<Boolean> setter, Boolean defaultValue, boolean hidden)
public String getNegateName()
public String getSingleLineUsage()
BaseArgumentgetSingleLineUsage in class BaseOptionpublic void validate()
BaseArgumentArgumentException if is did not validate with the appropriate
error message.validate in class BaseArgumentpublic int applyShort(String opts, ArgumentList args)
BaseOptionapplyShort in class BaseOptionopts - The remaining characters of the short opt list.args - The list of arguments including the short opt list.public int apply(ArgumentList args)
BaseOptionapply in class BaseOptionargs - The list of arguments.Copyright © 2016. All rights reserved.