public class CommandContext extends Object
| Constructor and Description |
|---|
CommandContext(String args) |
CommandContext(String[] args) |
CommandContext(String[] args,
Set<Character> valueFlags) |
CommandContext(String[] args,
Set<Character> expectedValueFlags,
boolean allowHangingFlag,
Namespace namespace)
Parse the given array of arguments.
|
CommandContext(String args,
Set<Character> valueFlags) |
CommandContext(String args,
Set<Character> valueFlags,
boolean allowHangingFlag) |
public CommandContext(String args) throws CommandException
CommandExceptionpublic CommandContext(String[] args) throws CommandException
CommandExceptionpublic CommandContext(String args, Set<Character> valueFlags) throws CommandException
CommandExceptionpublic CommandContext(String args, Set<Character> valueFlags, boolean allowHangingFlag) throws CommandException
CommandExceptionpublic CommandContext(String[] args, Set<Character> valueFlags) throws CommandException
CommandExceptionpublic CommandContext(String[] args, Set<Character> expectedValueFlags, boolean allowHangingFlag, Namespace namespace) throws CommandException
Empty arguments are removed from the list of arguments.
args - an array with argumentsexpectedValueFlags - a set containing all value flags (pass null to disable value flag parsing)allowHangingFlag - true if hanging flags are allowednamespace - the locals, null to create empty oneCommandException - thrown on a parsing errorpublic SuggestionContext getSuggestionContext()
public String getCommand()
public boolean matches(String command)
public String getString(int index)
public String getJoinedStrings(int initialIndex)
public String getRemainingString(int start)
public String getString(int start, int end)
public int getInteger(int index)
throws NumberFormatException
NumberFormatExceptionpublic int getInteger(int index,
int def)
throws NumberFormatException
NumberFormatExceptionpublic double getDouble(int index)
throws NumberFormatException
NumberFormatExceptionpublic double getDouble(int index,
double def)
throws NumberFormatException
NumberFormatExceptionpublic String[] getSlice(int index)
public String[] getPaddedSlice(int index, int padding)
public String[] getParsedSlice(int index)
public String[] getParsedPaddedSlice(int index, int padding)
public boolean hasFlag(char ch)
public String getFlag(char ch)
public int getFlagInteger(char ch)
throws NumberFormatException
NumberFormatExceptionpublic int getFlagInteger(char ch,
int def)
throws NumberFormatException
NumberFormatExceptionpublic double getFlagDouble(char ch)
throws NumberFormatException
NumberFormatExceptionpublic double getFlagDouble(char ch,
double def)
throws NumberFormatException
NumberFormatExceptionpublic int argsLength()
public Namespace getNamespace()
Copyright © 2015. All Rights Reserved.