public class Command extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Command.CommandException
Command exception.
|
Constructor and Description |
---|
Command(String args)
Instantiates a new command.
|
Command(String[] args)
Instantiates a new command.
|
Command(String[] args,
int argIdx)
Instantiates a new command.
|
Command(String underlyingLine,
String[] args,
Class<?> cliClass,
String usage)
Instantiates a new command.
|
Modifier and Type | Method and Description |
---|---|
Command |
append(Command command) |
Command |
append(String lineToAppend) |
void |
expect(int key)
Expect.
|
String |
get(int key)
Get.
|
char |
get(int key,
char defaultValue)
Get.
|
int |
get(int key,
int defaultValue)
Get.
|
String |
get(int key,
String defaultValue)
Get.
|
String |
get(String key)
Get the given key.
|
char |
get(String key,
char defaultValue)
Get.
|
int |
get(String key,
int defaultValue)
Get.
|
String |
get(String key,
String defaultValue)
Get.
|
String |
getJoinedArgs(int from) |
String |
getLine()
Gets the line.
|
String |
getLine(int startingArgumentIndex)
Get the arguments from the given index as a single string.
|
String |
getUnderlyingLine()
Get the underlying line as string that led to this command, with
any continuation character if there was any.
|
boolean |
has(int key)
Has.
|
boolean |
has(String key)
Has.
|
boolean |
is(String flag)
Is.
|
boolean |
isEmpty() |
boolean |
isPartialCommand() |
int |
size()
Size.
|
String |
toString() |
public Command(String args)
args
- the argspublic Command(String[] args)
args
- the argspublic Command(String[] args, int argIdx)
args
- the argsargIdx
- Start indexpublic String getLine()
public String getUnderlyingLine()
public String getLine(int startingArgumentIndex)
startingArgumentIndex
- starting argument indexpublic String get(String key)
key
- the keypublic String get(String key, String defaultValue)
key
- the keydefaultValue
- the default valuepublic int get(String key, int defaultValue)
key
- the keydefaultValue
- the default valuepublic char get(String key, char defaultValue)
key
- the keydefaultValue
- the default valuepublic String get(int key)
key
- the keypublic String getJoinedArgs(int from)
public String get(int key, String defaultValue)
key
- the keydefaultValue
- the default valuepublic int get(int key, int defaultValue)
key
- the keydefaultValue
- the default valuepublic char get(int key, char defaultValue)
key
- the keydefaultValue
- the default valuepublic boolean is(String flag)
flag
- the flagpublic void expect(int key)
key
- the keypublic boolean has(int key)
key
- the keypublic boolean has(String key)
key
- the keypublic int size()
public boolean isEmpty()
public String toString()
toString
in class Object
Object.toString()
public boolean isPartialCommand()
Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries