View Javadoc

1   /*
2    * This file is part of hyphenType. hyphenType is free software: you can
3    * redistribute it and/or modify it under the terms of the GNU General Public
4    * License as published by the Free Software Foundation, either version 3 of the
5    * License, or (at your option) any later version. hyphenType is distributed in
6    * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
7    * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
8    * the GNU General Public License for more details. You should have received a
9    * copy of the GNU General Public License along with hyphenType. If not, see
10   * <http://www.gnu.org/licenses/>.
11   */
12  package org.hyphenType.exit;
13  
14  import org.hyphenType.documentation.Description;
15  
16  
17  /**
18   * The simplest status code one could possibly conceive. Status codes in this
19   * enumeration will not do anything before JVM termination (in other words,
20   * {@link StatusCode#beforeExit()} is empty). This enumeration does not specify
21   * anything more meaningful than success versus failure. If you want your
22   * program to generate more specific codes, create your own enumeration that
23   * implements the {@link StatusCode} interface.
24   * 
25   * @author Aurelio Akira M. Matsui
26   */
27  public enum CanonicalExitCode implements StatusCode {
28      /**
29       * Status code to report a successful execution of a program.
30       */
31      @Description("Status code to report a successful execution of a program.\nStatus value is 0 (zero).")
32      @ExitStatusConstant(message = "", userDescription = "Successful termination")
33      SUCCESS,
34      /**
35       * Status code to report any problem during the execution of a program.
36       */
37      @Description("Status code to report any problem during the execution of a program.\nStatus value is 1.")
38      @ExitStatusConstant(message = "", userDescription = "Termination with error")
39      ERROR;
40  
41      @Override
42      public void beforeExit(ExitStatusHelper helper) {
43          /* 
44           * This exit code enum does not execute anything
45           * when exiting.
46           */
47      }
48  }