public class Argument extends BaseArgument
| Constructor and Description |
|---|
Argument(String name,
String usage,
Consumer<String> consumer)
Create a default required argument.
|
Argument(String name,
String usage,
Consumer<String> consumer,
String defaultValue)
Create a default optional argument with default value.
|
Argument(String name,
String usage,
Consumer<String> consumer,
String defaultValue,
Predicate<String> predicate,
boolean repeated,
boolean required,
boolean hidden)
Create an argument instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
apply(ArgumentList args)
Try to apply to the argument.
|
String |
getPrefix()
Prefix part of the usage usage message.
|
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.
|
getDefaultValue, getName, getUsage, isHidden, isRepeated, isRequiredpublic Argument(String name, String usage, Consumer<String> consumer)
name - The name of the argument.usage - The argument usage description.consumer - The argument consumer.public Argument(String name, String usage, Consumer<String> consumer, String defaultValue)
name - The name of the argument.usage - The argument usage description.consumer - The argument consumer.defaultValue - The default value.public Argument(String name, String usage, Consumer<String> consumer, String defaultValue, Predicate<String> predicate, boolean repeated, boolean required, boolean hidden)
name - The name of the argument.usage - The argument usage description.consumer - The argument consumer.defaultValue - The default value.predicate - A predicate to check if the argument should try to
consume the value.repeated - If the argument is repeated.required - If the argument is required.hidden - If the argument is hidden.public String getSingleLineUsage()
BaseArgumentgetSingleLineUsage in class BaseArgumentpublic String getPrefix()
BaseArgumentgetPrefix in class BaseArgumentpublic void validate()
throws ArgumentException
BaseArgumentArgumentException if is did not validate with the appropriate
error message.validate in class BaseArgumentArgumentExceptionpublic int apply(ArgumentList args)
BaseArgumentapply in class BaseArgumentargs - The argument list.Copyright © 2016. All rights reserved.