## grails.util
Enum Environment

    java.lang.Object
      java.lang.Enum<Environment>
          grails.util.Environment

All Implemented Interfaces:
  Serializable, Comparable<Environment>

    public enum Environment

extends Enum<Environment>

An enum that represents the current environment

Since:
  1.1

  Created: Dec 12, 2008
Author:
  Graeme Rocher

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

Field Summary
`static String` `DEFAULT` Constants that indicates whether this GrailsApplication is running in the default environment
`static String` `KEY` Constant used to resolve the environment via System.getProperty(Environment.KEY)

Method Summary
`static Environment` `getCurrent()` Returns the current environment which is typcally either DEVELOPMENT, PRODUCTION or TEST.
`static Environment` `getCurrentEnvironment()`
`static Environment` `getEnvironment(String shortName)` Returns the environment for the given short name
`String` `getName()`
`static boolean` `isSystemSet()`
`void` `setName(String name)`
`static Environment` `valueOf(String name)` Returns the enum constant of this type with the specified name.
`static Environment[]` `values()` Returns an array containing the constants of this enum type, in the order they're declared.

Methods inherited from class java.lang.Enum
`clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Enum Constant Detail

### DEVELOPMENT

    public static final Environment DEVELOPMENT

### PRODUCTION

    public static final Environment PRODUCTION

### TEST

    public static final Environment TEST

### APPLICATION

    public static final Environment APPLICATION

### CUSTOM

    public static final Environment CUSTOM

Field Detail

### KEY

    public static String KEY

  Constant used to resolve the environment via System.getProperty(Environment.KEY)

### DEFAULT

    public static final String DEFAULT

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

  See Also:
    Constant Field Values

Method Detail

### values

    public static final Environment[] values()

  Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:

      for(Environment c : Environment.values())
              System.out.println(c);

  Returns:
    an array containing the constants of this enum type, in the order they're declared

### valueOf

    public static Environment 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

### 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()

  See Also:
    `getCurrent()`

### isSystemSet

    public static boolean isSystemSet()

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

### 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

### getName

    public String getName()

  Returns:
    The name of the environment

### setName

    public void setName(String name)

Copyright (c) 2005-2009 The Grails project