public class CommandType extends Object implements Serializable, Comparable
| Constructor and Description |
|---|
CommandType(CommandType original)
Copy constructor for
CommandType. |
CommandType(String nameVersion)
Constructor for
CommandType given a string string that encodes both the command type name and version. |
CommandType(String name,
int version)
Constructor for
CommandType. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Object obj)
Used strictly to determine if one command type has a higher or lower version number than another with the same
command type name. |
boolean |
equals(Object obj)
|
String |
getName()
Returns the name of this command type.
|
int |
getVersion()
Returns the version number associated with this command type.
|
int |
hashCode() |
String |
toString()
This will return the name of the command following by the version (prefixed with a 'v') unless the version number
is 1, in which case just the name is returned.
|
public CommandType(String name, int version) throws IllegalArgumentException
CommandType.name - the name of the command typeversion - the version of the command typeIllegalArgumentException - if name is null or emptypublic CommandType(CommandType original)
CommandType.original - the original object to copypublic CommandType(String nameVersion) throws IllegalArgumentException
CommandType given a string string that encodes both the command type name and version.
The string must separate the name and version with a space. The version may simply be a number or (as with the
format returned by toString()) may be prefixed with 'v'. Examples: "cmd 5", "cmd v5". If just the name
was specified with no version, the version will default to 1.nameVersion - command type name and version separated with a spaceIllegalArgumentException - if name is null or nameVersion was
invalidpublic String getName()
public int getVersion()
public String toString()
toString in class ObjectObject.toString()public boolean equals(Object obj)
equals in class ObjectObject.equals(java.lang.Object)public int hashCode()
hashCode in class ObjectObject.hashCode()public int compareTo(Object obj) throws IllegalArgumentException
command type name. If the given object's command type name does not equal this object's
command type name, an IllegalArgumentException is thrown - you cannot compare two command types with
different names.compareTo in interface ComparableIllegalArgumentExceptionComparable.compareTo(java.lang.Object)Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.