public interface CommandArgs
| Modifier and Type | Method and Description |
|---|---|
Map<Character,String> |
getFlags()
Get a map of defined flags.
|
Namespace |
getNamespace()
Get the map of provided values.
|
boolean |
hasNext()
Tests whether there are additional arguments that can be read.
|
void |
markConsumed()
Move the pointer to the end so that there are no unconsumed arguments.
|
String |
next()
Read the next argument.
|
boolean |
nextBoolean()
Read the next argument as a boolean.
|
byte |
nextByte()
Read the next argument as a byte.
|
double |
nextDouble()
Read the next argument as a double.
|
float |
nextFloat()
Read the next argument as a float.
|
int |
nextInt()
Read the next argument as an integer.
|
short |
nextShort()
Read the next argument as a short.
|
String |
peek()
Return the next argument without moving the pointer.
|
int |
position()
Get the current position of the pointer in the stack of arguments.
|
int |
size()
Return the number of arguments in total.
|
boolean hasNext()
String next() throws MissingArgumentException
MissingArgumentException - Thrown if there are no remaining argumentsint nextInt()
throws MissingArgumentException,
ArgumentParseException
MissingArgumentException - Thrown if there are no remaining argumentsArgumentParseException - Thrown if the next argument could not be parsed to an integershort nextShort()
throws MissingArgumentException,
ArgumentParseException
MissingArgumentException - Thrown if there are no remaining argumentsArgumentParseException - Thrown if the next argument could not be parsed to an shortbyte nextByte()
throws MissingArgumentException,
ArgumentParseException
MissingArgumentException - Thrown if there are no remaining argumentsArgumentParseException - Thrown if the next argument could not be parsed to an bytedouble nextDouble()
throws MissingArgumentException,
ArgumentParseException
MissingArgumentException - Thrown if there are no remaining argumentsArgumentParseException - Thrown if the next argument could not be parsed to an doublefloat nextFloat()
throws MissingArgumentException,
ArgumentParseException
MissingArgumentException - Thrown if there are no remaining argumentsArgumentParseException - Thrown if the next argument could not be parsed to an floatboolean nextBoolean()
throws MissingArgumentException,
ArgumentParseException
MissingArgumentException - Thrown if there are no remaining argumentsArgumentParseException - Thrown if the next argument could not be parsed to an booleanString peek() throws MissingArgumentException
MissingArgumentException - Thrown if there are no remaining argumentsint position()
The current position indicates the value that will be returned by the
next call to next() and it starts at 0. If the current position
is equal to size(), then there are no more arguments
available.
int size()
void markConsumed()
Map<Character,String> getFlags()
Keys are the flag (case-sensitive) and values are the values for
the flag. For boolean flags, the value should be the string "true". Flags
are commonly defined by the player by using syntax similar to
-X value.
Copyright © 2015. All Rights Reserved.