public class CommandFormat extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CommandFormat.IllegalNumberOfArgumentsException
Used when the arguments exceed their bounds
|
static class |
CommandFormat.NotEnoughArgumentsException
Used when too few arguments are supplied to a command
|
static class |
CommandFormat.TooManyArgumentsException
Used when too many arguments are supplied to a command
|
static class |
CommandFormat.UnknownOptionException
Used when an unsupported option is supplied to a command
|
| Constructor and Description |
|---|
CommandFormat(int min,
int max,
String... possibleOpt)
Simple parsing of command line arguments
|
CommandFormat(String n,
int min,
int max,
String... possibleOpt)
Deprecated.
use replacement since name is an unused parameter
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getOpt(String option)
Return if the option is set or not
|
Set<String> |
getOpts()
Returns all the options that are set
|
void |
parse(List<String> args)
Parse parameters from the given list of args.
|
List<String> |
parse(String[] args,
int pos)
Parse parameters starting from the given position
Consider using the variant that directly takes a List
|
@Deprecated public CommandFormat(String n, int min, int max, String... possibleOpt)
name - of command, but never usedmin - see replacementmax - see replacementpossibleOpt - see replacementCommandFormat(int, int, String...)public CommandFormat(int min,
int max,
String... possibleOpt)
min - minimum arguments requiredmax - maximum arguments permittedpossibleOpt - list of the allowed switchespublic List<String> parse(String[] args, int pos)
args - an array of input argumentspos - the position at which starts to parsepublic void parse(List<String> args)
args - as a list of input argumentspublic boolean getOpt(String option)
option - String representation of an optionCopyright © 2013 Apache Software Foundation. All rights reserved.