Package: grails.util

## [Java] Class Holders

- grails.util.Holders

-     public class Holders
      extends java.lang.Object

  Allows looking up key classes in a static context

  Authors:
    Burt Beckwith
    Graeme Rocher
  Since:
    2.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private static org.apache.commons.logging.Log` | `LOG` |
    `private static java.util.List<GrailsApplicationDiscoveryStrategy>` | `applicationDiscoveryStrategies` |
    `private static GrailsApplication` | `applicationSingleton` |
    `private static Holder<Config>` | `configs` |
    `private static Holder<java.util.Map<?, ?>>` | `flatConfigs` |
    `private static Holder<GrailsPluginManager>` | `pluginManagers` |
    `private static Holder<java.lang.Boolean>` | `pluginManagersInCreation` |
    `private static Holder` | `servletContexts` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `private Holders ()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static void` | `addApplicationDiscoveryStrategy(GrailsApplicationDiscoveryStrategy strategy)`
    `` | `public static void` | `clear()`
    `` | `private static void` | `createServletContextsHolder()`
    `` | `public static GrailsPluginManager` | `currentPluginManager()`
    `` | `public static GrailsApplication` | `findApplication()` Returns: The ApplicationContext or null if it doesn't exist
    `` | `public static org.springframework.context.ApplicationContext` | `findApplicationContext()` Returns: The ApplicationContext or null if it doesn't exist
    `<T>` | `private static T` | `get(Holder<T> holder, java.lang.String type)`
    `<T>` | `private static T` | `get(Holder<T> holder, java.lang.String type, boolean mappedOnly)`
    `` | `public static org.springframework.context.ApplicationContext` | `getApplicationContext()`
    `` | `public static Config` | `getConfig()`
    `` | `public static java.util.Map<?, ?>` | `getFlatConfig()`
    `` | `public static GrailsApplication` | `getGrailsApplication()`
    `` | `public static GrailsPluginManager` | `getPluginManager()`
    `` | `public static GrailsPluginManager` | `getPluginManager(boolean mappedOnly)`
    `` | `public static java.lang.Object` | `getServletContext()`
    `` | `public static void` | `reset()`
    `` | `public static void` | `setConfig(Config config)`
    `` | `public static void` | `setGrailsApplication(GrailsApplication application)`
    `` | `public static void` | `setPluginManager(GrailsPluginManager pluginManager)`
    `` | `public static void` | `setPluginManagerInCreation(boolean inCreation)`
    `` | `public static void` | `setServletContext(java.lang.Object servletContext)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### private static final org.apache.commons.logging.Log LOG

    - #### private static java.util.List<GrailsApplicationDiscoveryStrategy> applicationDiscoveryStrategies

    - #### private static GrailsApplication applicationSingleton

    - #### private static Holder<Config> configs

    - #### private static Holder<java.util.Map<?, ?>> flatConfigs

    - #### private static Holder<GrailsPluginManager> pluginManagers

    - #### private static Holder<java.lang.Boolean> pluginManagersInCreation

    - #### private static Holder servletContexts

  - ### Constructor Detail

    - #### private Holders()

  - ### Method Detail

    - #### public static void addApplicationDiscoveryStrategy(GrailsApplicationDiscoveryStrategy strategy)

    - #### public static void clear()

    - #### @java.lang.SuppressWarnings("unchecked") private static void createServletContextsHolder()

    - #### public static GrailsPluginManager currentPluginManager()

    - #### public static GrailsApplication findApplication()

      Returns:
        The ApplicationContext or null if it doesn't exist

    - #### public static org.springframework.context.ApplicationContext findApplicationContext()

      Returns:
        The ApplicationContext or null if it doesn't exist

    - #### <T> private static T get(Holder<T> holder, java.lang.String type)

    - #### <T> private static T get(Holder<T> holder, java.lang.String type, boolean mappedOnly)

    - #### public static org.springframework.context.ApplicationContext getApplicationContext()

    - #### public static Config getConfig()

    - #### public static java.util.Map<?, ?> getFlatConfig()

    - #### public static GrailsApplication getGrailsApplication()

    - #### public static GrailsPluginManager getPluginManager()

    - #### public static GrailsPluginManager getPluginManager(boolean mappedOnly)

    - #### public static java.lang.Object getServletContext()

    - #### public static void reset()

    - #### public static void setConfig(Config config)

    - #### public static void setGrailsApplication(GrailsApplication application)

    - #### public static void setPluginManager(GrailsPluginManager pluginManager)

    - #### public static void setPluginManagerInCreation(boolean inCreation)

    - #### public static void setServletContext(java.lang.Object servletContext)