public class CommandProcessor extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CommandProcessor.Option
A simple immutable object represents meta-data about a command option.
|
Constructor and Description |
---|
CommandProcessor() |
Modifier and Type | Method and Description |
---|---|
CommandProcessor.Option |
findCommand(String option)
Finds a command with the given name.
|
boolean |
getAllowsUnregisteredOption() |
Set<CommandProcessor.Option> |
getUnregisteredCommands()
Gets all the unrecognized command options.
|
String |
getValue(String alias)
Gets value of the option matching the given alias.
|
int |
lastIndex(String[] args)
Gets the last index in the given array that can be processed as an option.
|
CommandProcessor.Option |
register(boolean requiresValue,
String... aliases)
Register the given aliases as a command option.
|
void |
setAllowsUnregisteredOption(boolean allowsUnregisteredOption) |
String[] |
setFrom(String[] args)
Set the option values from the given arguments.
|
String[] |
setFrom(String[] args,
int from,
int to)
Set the option values from the given arguments between the given indices.
|
public String[] setFrom(String[] args)
args
- an array of arguments.lastIndex(String[])
public String[] setFrom(String[] args, int from, int to)
args
- an array of arguments.lastIndex(String[])
public int lastIndex(String[] args)
args
- an array of argumentspublic CommandProcessor.Option register(boolean requiresValue, String... aliases)
requiresValue
- if true then the option must be specified with a value.aliases
- strings to recognize this option. Each must begin with a dash character.public CommandProcessor.Option findCommand(String option)
option
- a command alias.public Set<CommandProcessor.Option> getUnregisteredCommands()
public String getValue(String alias)
alias
- an alias.public boolean getAllowsUnregisteredOption()
public void setAllowsUnregisteredOption(boolean allowsUnregisteredOption)
allowsUnregisteredOption
- the allowsUnregisteredOption to setCopyright © 2006–2018 Apache Software Foundation. All rights reserved.