Enum DeploymentMode

java.lang.Object
java.lang.Enum<DeploymentMode>
com.mastfrog.giulius.DeploymentMode
All Implemented Interfaces:
Serializable, Comparable<DeploymentMode>, java.lang.constant.Constable

public enum DeploymentMode extends Enum<DeploymentMode>
Determine if we are in development mode or production mode. This corresponds to Guice's STAGE (minus tool mode); Guice 3.1 no longer allows binding Stage directly, so this class replaces requesting injection of that.
Author:
Tim Boudreau
  • Enum Constant Details

  • Method Details

    • values

      public static DeploymentMode[] 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 DeploymentMode 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
    • isProduction

      public boolean isProduction()
    • inUnitTest

      public boolean inUnitTest()
      Detect if running inside a test. Uses system properties unit.test (set by giulius-tests), forkNumber and surefire.forkNumber (Maven common practices) to detect it.

      This is needed for certain things, such as the MongoDB test harness, where an index build can be scheduled as the process is shutting down, causing a panic if files are already deleted.

      Returns:
      True if, according to the above criteria, the JVM is running a unit test.