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()
CommandArgument
getIndex
in interface CommandArgument
public CommandLineCompleter getValueCompleter()
CommandArgument
getValueCompleter
in interface CommandArgument
public String getValue(ParsedCommandLine args)
CommandArgument
getValue
in interface CommandArgument
args
- parsed arguments.public String getValue(ParsedCommandLine args, boolean required) throws CommandFormatException
CommandArgument
getValue
in interface CommandArgument
args
- parsed arguments.required
- whether the value for this argument is required.CommandFormatException
public boolean isPresent(ParsedCommandLine args) throws CommandFormatException
CommandArgument
isPresent
in interface CommandArgument
args
- parsed argumentsCommandFormatException
public boolean isValueComplete(ParsedCommandLine args) throws CommandFormatException
CommandArgument
isValueComplete
in interface CommandArgument
args
- the parsed argumentsCommandFormatException
public String getFullName()
CommandArgument
getFullName
in interface CommandArgument
public boolean canAppearNext(CommandContext ctx) throws CommandFormatException
CommandArgument
canAppearNext
in interface CommandArgument
CommandFormatException
public boolean isValueRequired()
CommandArgument
isValueRequired
in interface CommandArgument
public String getShortName()
CommandArgument
getShortName
in interface CommandArgument
public void setAccessRequirement(AccessRequirement access)
Copyright © 2023 JBoss by Red Hat. All rights reserved.