org.hyphenType.exit
Enum CanonicalExitCode

java.lang.Object
  extended by java.lang.Enum<CanonicalExitCode>
      extended by org.hyphenType.exit.CanonicalExitCode
All Implemented Interfaces:
Serializable, Comparable<CanonicalExitCode>, StatusCode

public enum CanonicalExitCode
extends Enum<CanonicalExitCode>
implements StatusCode

The simplest status code one could possibly conceive. Status codes in this enumeration will not do anything before JVM termination (in other words, StatusCode#beforeExit() is empty). This enumeration does not specify anything more meaningful than success versus failure. If you want your program to generate more specific codes, create your own enumeration that implements the StatusCode interface.

Author:
Aurelio Akira M. Matsui

Enum Constant Summary
ERROR
          Status code to report any problem during the execution of a program.
SUCCESS
          Status code to report a successful execution of a program.
 
Method Summary
 void beforeExit(ExitStatusHelper helper)
          A call back method that is invoked by the method Options#exit(Enum) right before attempting to terminate the VM.
static CanonicalExitCode valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CanonicalExitCode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

SUCCESS

public static final CanonicalExitCode SUCCESS
Status code to report a successful execution of a program.


ERROR

public static final CanonicalExitCode ERROR
Status code to report any problem during the execution of a program.

Method Detail

values

public static CanonicalExitCode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (CanonicalExitCode c : CanonicalExitCode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static CanonicalExitCode valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

beforeExit

public void beforeExit(ExitStatusHelper helper)
Description copied from interface: StatusCode
A call back method that is invoked by the method Options#exit(Enum) right before attempting to terminate the VM. This method can be used to output custom message to the console, for instance.
This method is similar to a Runtime.addShutdownHook(Thread). The main difference is that this method will be called on the enumeration constant related to the exit status.

Specified by:
beforeExit in interface StatusCode
Parameters:
helper - A helper object that gives access to some utility methods.


Copyright © 2013. All Rights Reserved.