Environment (Griffon 0.9.5-rc2)
Date: 2012-03-09

Overview | Package | Class | Deprecated | Index | Help
| Griffon 0.9.5-rc2
| FRAMES NO FRAMES
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD

## griffon.util
[Java] Enum Environment

    java.lang.Object
      java.lang.Enum
          griffon.util.Environment

    public enum Environment
    extends Enum

An enum that represents the current environment

Authors:
  Graeme Rocher (Grails 1.1)

Nested Class Summary
`private static class` | `Environment.EnvironmentBlockEvaluator`

Enum Constant Summary
`CUSTOM`
`DEVELOPMENT`
`PRODUCTION`
`TEST`

Field Summary
`static String` | `DEFAULT` Constants that indicates whether this GriffonApplication is running in the default environment
`private static String` | `DEVELOPMENT_ENVIRONMENT_SHORT_NAME`
`static String` | `KEY` An enum that represents the current environment
`private static String` | `PRODUCTION_ENV_SHORT_NAME`
`private static String` | `TEST_ENVIRONMENT_SHORT_NAME`
`private static Map` | `envNameMappings`
`private String` | `name`

Method Summary
`private static Environment.EnvironmentBlockEvaluator` | `evaluateEnvironmentSpecificBlock(Environment environment, Closure closure)`
`static Object` | `executeForCurrentEnvironment(Closure closure)` Takes an environment specific DSL block like:
`static Object` | `executeForEnvironment(Environment env, Closure closure)` Takes an environment specific DSL block like:
`static Environment` | `getCurrent()` Returns the current environment which is typcally either DEVELOPMENT, PRODUCTION or TEST.
`static Environment` | `getCurrentEnvironment()` @see #getCurrent()
`static Environment` | `getEnvironment(String shortName)` Returns the environment for the given short name
`static Closure` | `getEnvironmentSpecificBlock(Closure closure)` Takes an environment specific DSL block like:
`static Closure` | `getEnvironmentSpecificBlock(Environment env, Closure closure)` Takes an environment specific DSL block like:
`String` | `getName()` @return The name of the environment
`private static boolean` | `isBlank(String value)`
`static boolean` | `isSystemSet()` @return Return true if the environment has been set as a System property
`void` | `setName(String name)`
`Environment` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
`Environment[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

Methods inherited from class Enum
name, equals, toString, hashCode, compareTo, compareTo, valueOf, getDeclaringClass, ordinal, wait, wait, wait, getClass, notify, notifyAll

Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Enum Constant Detail

### CUSTOM

    Environment CUSTOM

### DEVELOPMENT

    Environment DEVELOPMENT

### PRODUCTION

    Environment PRODUCTION

### TEST

    Environment TEST

Field Detail

### DEFAULT

    public static final String DEFAULT

  Constants that indicates whether this GriffonApplication is running in the default environment

### DEVELOPMENT_ENVIRONMENT_SHORT_NAME

    private static final String DEVELOPMENT_ENVIRONMENT_SHORT_NAME

### KEY

    public static final String KEY

  An enum that represents the current environment
  Authors:
    Graeme Rocher (Grails 1.1)

### PRODUCTION_ENV_SHORT_NAME

    private static final String PRODUCTION_ENV_SHORT_NAME

### TEST_ENVIRONMENT_SHORT_NAME

    private static final String TEST_ENVIRONMENT_SHORT_NAME

### envNameMappings

    private static Map envNameMappings

### name

    private String name

Method Detail

### evaluateEnvironmentSpecificBlock

    private static Environment.EnvironmentBlockEvaluator evaluateEnvironmentSpecificBlock(Environment environment, Closure closure)

### executeForCurrentEnvironment

    public static Object executeForCurrentEnvironment(Closure closure)

  Takes an environment specific DSL block like: `environments { development {} production {} }` And executes the closure that relates to the current environment
  Parameters:
    `closure` - The top level closure
  Returns:
    The result of the closure execution

### executeForEnvironment

    public static Object executeForEnvironment(Environment env, Closure closure)

  Takes an environment specific DSL block like: `environments { development {} production {} }` And executes the closure that relates to the specified environment
  Parameters:
    `env` - The environment to use
    `closure` - The top level closure
  Returns:
    The result of the closure execution

### getCurrent

    public static Environment getCurrent()

  Returns the current environment which is typcally either DEVELOPMENT, PRODUCTION or TEST. For custom environments CUSTOM type is returned.
  Returns:
    The current environment.

### getCurrentEnvironment

    public static Environment getCurrentEnvironment()

  Returns:
    the current environment
  See Also:
    getCurrent()

### getEnvironment

    public static Environment getEnvironment(String shortName)

  Returns the environment for the given short name
  Parameters:
    `shortName` - The short name
  Returns:
    The Environment or null if not known

### getEnvironmentSpecificBlock

    public static Closure getEnvironmentSpecificBlock(Closure closure)

  Takes an environment specific DSL block like: `environments { development {} production {} }` And returns the closure that relates to the current environment
  Parameters:
    `closure` - The top level closure
  Returns:
    The environment specific block or null if non exists

### getEnvironmentSpecificBlock

    public static Closure getEnvironmentSpecificBlock(Environment env, Closure closure)

  Takes an environment specific DSL block like: `environments { development {} production {} }` And returns the closure that relates to the specified
  Parameters:
    `env` - The environment to use
    `closure` - The top level closure
  Returns:
    The environment specific block or null if non exists

### getName

    public String getName()

  Returns:
    The name of the environment

### isBlank

    private static boolean isBlank(String value)

### isSystemSet

    public static boolean isSystemSet()

  Returns:
    Return true if the environment has been set as a System property

### setName

    public void setName(String name)

### valueOf

    Environment valueOf(String name)

  Returns the enum constant of this type with the specified name.

### values

    Environment[] values()

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

Groovy Documentation