com.mcdermottroe.exemplar.ui.cli
Class ExitCode

java.lang.Object
  extended by com.mcdermottroe.exemplar.ui.cli.ExitCode
All Implemented Interfaces:
Copyable<ExitCode>, Comparable<ExitCode>

public class ExitCode
extends Object
implements Comparable<ExitCode>, Copyable<ExitCode>

A structure for keeping exit codes.

Since:
0.2

Field Summary
private  String description
          A description of the exit code and what it's used for.
private  String mnemonic
          The short name for the exit code.
private  int numericForm
          The numeric form to be passed to System.exit(int).
 
Constructor Summary
ExitCode(int code, String name, String desc)
          Simple constructor, just sets the members.
 
Method Summary
 int compareTo(ExitCode other)
          Implement Comparable.compareTo(Object).
 boolean equals(Object o)
          Implement Object.equals(Object).
 ExitCode getCopy()
          Creates a deep copy of the current object and returns it.
 String getDescription()
          Getter for the description member.
 String getMnemonic()
          Getter for the mnemonic member.
 int getNumericForm()
          Getter for the numericForm member.
 int hashCode()
          Implement Object.hashCode().
 String toString()
          Synonym for getMnemonic().
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

numericForm

private final int numericForm
The numeric form to be passed to System.exit(int).


mnemonic

private final String mnemonic
The short name for the exit code.


description

private final String description
A description of the exit code and what it's used for.

Constructor Detail

ExitCode

public ExitCode(int code,
                String name,
                String desc)
Simple constructor, just sets the members.

Parameters:
code - The value for numericForm.
name - The value for mnemonic.
desc - The value for description.
Method Detail

compareTo

public int compareTo(ExitCode other)
Implement Comparable.compareTo(Object).

Specified by:
compareTo in interface Comparable<ExitCode>
Parameters:
other - The ExitCode to compare with.
Returns:
A result as defined by Comparable.compareTo(Object).

getNumericForm

public int getNumericForm()
Getter for the numericForm member.

Returns:
The value of the numericForm member.

getMnemonic

public String getMnemonic()
Getter for the mnemonic member.

Returns:
The value of the mnemonic member.

getDescription

public String getDescription()
Getter for the description member.

Returns:
The value of the description member.

toString

public String toString()
Synonym for getMnemonic().

Overrides:
toString in class Object
Returns:
The value of the mnemonic member.

equals

public boolean equals(Object o)
Implement Object.equals(Object).

Overrides:
equals in class Object
Parameters:
o - The other object to compare this with.
Returns:
True if this equals o.

hashCode

public int hashCode()
Implement Object.hashCode().

Overrides:
hashCode in class Object
Returns:
A hash code for this object.

getCopy

public ExitCode getCopy()
Creates a deep copy of the current object and returns it.

Specified by:
getCopy in interface Copyable<ExitCode>
Returns:
A deep copy of the current object.