public class ArgumentWithoutValue extends Object implements CommandArgument
| Modifier and Type | Field and Description |
|---|---|
protected AccessRequirement |
access |
protected List<CommandArgument> |
cantAppearAfter |
protected boolean |
exclusive |
protected String |
fullName |
protected int |
index |
protected List<CommandArgument> |
requiredPreceding |
protected String |
shortName |
| Constructor and Description |
|---|
ArgumentWithoutValue(CommandHandlerWithArguments handler,
int index,
String fullName) |
ArgumentWithoutValue(CommandHandlerWithArguments handler,
String fullName) |
ArgumentWithoutValue(CommandHandlerWithArguments handler,
String fullName,
String shortName) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCantAppearAfter(CommandArgument arg) |
void |
addRequiredPreceding(CommandArgument arg) |
boolean |
canAppearNext(CommandContext ctx)
Checks whether the argument can appear on the command
given the already present arguments.
|
String |
getFullName()
The default name of the argument.
|
int |
getIndex()
If the argument doesn't have a name its value can be found by index.
|
String |
getShortName()
Short name of the argument if exists.
|
String |
getValue(ParsedCommandLine args)
Returns the value of the argument specified on the command line.
|
String |
getValue(ParsedCommandLine args,
boolean required)
Returns the value of the argument specified on the command line.
|
CommandLineCompleter |
getValueCompleter()
Returns the tab-completer for the value.
|
boolean |
isPresent(ParsedCommandLine args)
Checks whether the argument is present on the command line.
|
boolean |
isValueComplete(ParsedCommandLine args)
Checks whether the value is specified and complete.
|
boolean |
isValueRequired()
Checks whether the argument accepts value.
|
void |
setAccessRequirement(AccessRequirement access) |
void |
setExclusive(boolean exclusive) |
protected final int index
protected final String fullName
protected final String shortName
protected List<CommandArgument> requiredPreceding
protected List<CommandArgument> cantAppearAfter
protected boolean exclusive
protected AccessRequirement access
public ArgumentWithoutValue(CommandHandlerWithArguments handler, String fullName)
public ArgumentWithoutValue(CommandHandlerWithArguments handler, String fullName, String shortName)
public ArgumentWithoutValue(CommandHandlerWithArguments handler, int index, String fullName)
public void setExclusive(boolean exclusive)
public void addRequiredPreceding(CommandArgument arg)
public void addCantAppearAfter(CommandArgument arg)
public int getIndex()
CommandArgumentgetIndex in interface CommandArgumentpublic CommandLineCompleter getValueCompleter()
CommandArgumentgetValueCompleter in interface CommandArgumentpublic String getValue(ParsedCommandLine args)
CommandArgumentgetValue in interface CommandArgumentargs - parsed arguments.public String getValue(ParsedCommandLine args, boolean required) throws CommandFormatException
CommandArgumentgetValue in interface CommandArgumentargs - parsed arguments.required - whether the value for this argument is required.CommandFormatExceptionpublic boolean isPresent(ParsedCommandLine args) throws CommandFormatException
CommandArgumentisPresent in interface CommandArgumentargs - parsed argumentsCommandFormatExceptionpublic boolean isValueComplete(ParsedCommandLine args) throws CommandFormatException
CommandArgumentisValueComplete in interface CommandArgumentargs - the parsed argumentsCommandFormatExceptionpublic String getFullName()
CommandArgumentgetFullName in interface CommandArgumentpublic boolean canAppearNext(CommandContext ctx) throws CommandFormatException
CommandArgumentcanAppearNext in interface CommandArgumentCommandFormatExceptionpublic boolean isValueRequired()
CommandArgumentisValueRequired in interface CommandArgumentpublic String getShortName()
CommandArgumentgetShortName in interface CommandArgumentpublic void setAccessRequirement(AccessRequirement access)
Copyright © 2014 JBoss by Red Hat. All rights reserved.