Package com.mastfrog.giulius
Enum DeploymentMode
- All Implemented Interfaces:
Serializable,Comparable<DeploymentMode>,java.lang.constant.Constable
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetect if running inside a test.booleanstatic DeploymentModeReturns the enum constant of this type with the specified name.static DeploymentMode[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
PRODUCTION
-
DEVELOPMENT
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
isProduction
public boolean isProduction() -
inUnitTest
public boolean inUnitTest()Detect if running inside a test. Uses system propertiesunit.test(set by giulius-tests),forkNumberandsurefire.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.
-