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