public final class Command
extends java.lang.Object
| Constructor and Description |
|---|
Command(java.lang.String name,
java.util.List parameters)
Construct a new immutable instance with the specified command name and parameters
|
Command(java.lang.String name,
java.lang.String[] parameters)
Construct a new immutable instance with the specified command name and parameters
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getName() |
java.lang.String |
getOptionalString(int index)
Get the String value of the parameter at the specified index; return null if no
parameter exists for the index.
|
java.lang.String |
getParameter(int index)
Get the String value of the parameter at the specified index; return null if no parameter exists for the index
|
java.lang.String[] |
getParameters() |
java.lang.String |
getRequiredParameter(int index)
Get the String value of the parameter at the specified index
|
int |
hashCode() |
static java.lang.String |
normalizeName(java.lang.String name)
Return the name, normalized to a common format - convert to upper case.
|
java.lang.String |
toString()
Return the String representation of this object
|
public Command(java.lang.String name,
java.lang.String[] parameters)
name - - the command name; may not be nullparameters - - the command parameters; may be empty; may not be nullpublic Command(java.lang.String name,
java.util.List parameters)
name - - the command name; may not be nullparameters - - the command parameters; may be empty; may not be nullpublic java.lang.String getName()
public java.lang.String[] getParameters()
public java.lang.String getRequiredParameter(int index)
index - - the indexAssertFailedException - if the parameter index is invalid or the value is not a valid Stringpublic java.lang.String getParameter(int index)
index - - the indexpublic java.lang.String getOptionalString(int index)
getParameter(int).index - - the indexpublic boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(java.lang.Object)public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public static java.lang.String normalizeName(java.lang.String name)
name - - the command name