Enum DevelopMode

java.lang.Object
java.lang.Enum<DevelopMode>
org.sm.smtools.application.util.DevelopMode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<DevelopMode>, java.lang.constant.Constable

public enum DevelopMode
extends java.lang.Enum<DevelopMode>
The DevelopMode class allows a global specification of an application's status.

This class can be used to check whether or not an application should use 'hacks' during its development. These hacks are created by the programmer. They provide convenient backdoors during the development phase (e.g., for skipping intros, about boxes, confirmation dialogs when quitting, ...). Their use is checked against a global flag, in the following manner:

   if (DevelopMode.kINSTANCE.isActivated()) {
     ... // perform 'hacks'
   }
 
Changing the status is done through direct assignment:
   DevelopMode.kINSTANCE.activate();
 

If activation is required before any class initialisation, then use a static initialiser as follows:

   static {
DevelopMode.kINSTANCE.activate();
}
Note that the default value is false.
Version:
26/06/2018
Author:
Sven Maerivoet
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant Description
    kINSTANCE
    The singleton instance.
  • Method Summary

    Modifier and Type Method Description
    void activate()
    Activates develop mode.
    void deactivate()
    Deactivates develop mode.
    boolean isActivated()
    Returns whether or not the develop mode is activated.
    static DevelopMode valueOf​(java.lang.String name)
    Returns the enum constant of this type with the specified name.
    static DevelopMode[] 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, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • kINSTANCE

      public static final DevelopMode kINSTANCE
      The singleton instance.
  • Method Details

    • values

      public static DevelopMode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static DevelopMode valueOf​(java.lang.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:
      java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
      java.lang.NullPointerException - if the argument is null
    • activate

      public void activate()
      Activates develop mode.
    • deactivate

      public void deactivate()
      Deactivates develop mode.
    • isActivated

      public boolean isActivated()
      Returns whether or not the develop mode is activated.
      Returns:
      true if the develop mode is activated, false otherwise