Plugin (Grails 3.2.9)
Date: 2017-04-26

Package: grails.plugins

## [Groovy] Class Plugin

- grails.plugins.Plugin

- All Implemented Interfaces and Traits:
    GrailsApplicationAware, GrailsApplicationLifeCycle, org.springframework.context.ApplicationContextAware, PluginManagerAware

      @groovy.transform.CompileStatic
      abstract class Plugin
      extends java.lang.Object

  Super class for plugins to implement. Plugin implementations should define the various plugin hooks (doWithSpring, doWithApplicationContext, doWithDynamicMethods etc.)

  Authors:
    Graeme Rocher
  Since:
    3.0

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `java.util.List<ArtefactHandler>` | `artefacts` List of ArtefactHandler instances provided by this plugin
    `boolean` | `enabled` Whether the plugin is enabled
    `Environment` | `environment` The current Grails Environment
    `GrailsApplication` | `grailsApplication` The GrailsApplication instance
    `GrailsPlugin` | `plugin` The GrailsPlugin definition for this plugin
    `GrailsPluginManager` | `pluginManager` The GrailsPluginManager instance

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `beans(groovy.lang.Closure beanDefinitions)` Allows a plugin to define beans at runtime.
    `` | `void` | `doWithApplicationContext()` Invokes once the org.springframework.context.ApplicationContext has been refreshed and after {#doWithDynamicMethods()} is invoked.
    `` | `void` | `doWithDynamicMethods()` Invoked in a phase where plugins can add dynamic methods.
    `` | `groovy.lang.Closure` | `doWithSpring()` Sub classes should override to provide implementations
    `` | `org.springframework.context.ConfigurableApplicationContext` | `getApplicationContext()` @return The ApplicationContext
    `` | `Config` | `getConfig()` @return The Config instance for this plugin
    `` | `GrailsPluginManager` | `getManager()` The GrailsPluginManager instance
    `` | `void` | `onChange(java.util.Map<java.lang.String, java.lang.Object> event)` Invoked when a object this plugin is watching changes
    `` | `void` | `onConfigChange(java.util.Map<java.lang.String, java.lang.Object> event)` Invoked when the application configuration changes
    `` | `void` | `onShutdown(java.util.Map<java.lang.String, java.lang.Object> event)` Invoked when the org.springframework.context.ApplicationContext is closed
    `` | `void` | `onStartup(java.util.Map<java.lang.String, java.lang.Object> event)`
    `` | `void` | `setApplicationContext(org.springframework.context.ApplicationContext applicationContext)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), 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()`

- - ### Property Detail

    - #### final java.util.List<ArtefactHandler> artefacts

      List of ArtefactHandler instances provided by this plugin

    - #### boolean enabled

      Whether the plugin is enabled

    - #### Environment environment

      The current Grails Environment

    - #### GrailsApplication grailsApplication

      The GrailsApplication instance

    - #### GrailsPlugin plugin

      The GrailsPlugin definition for this plugin

    - #### GrailsPluginManager pluginManager

      The GrailsPluginManager instance

  - ### Method Detail

    - #### void beans(groovy.lang.Closure beanDefinitions)

      Allows a plugin to define beans at runtime. Used primarily for reloading in development mode

      Parameters:
        `beanDefinitions` - The bean definitions
      Returns:
        The BeanBuilder instance

    - #### @java.lang.Override void doWithApplicationContext()

      Invokes once the org.springframework.context.ApplicationContext has been refreshed and after {#doWithDynamicMethods()} is invoked. Subclasses should override

    - #### @java.lang.Override void doWithDynamicMethods()

      Invoked in a phase where plugins can add dynamic methods. Subclasses should override

    - #### @java.lang.Override groovy.lang.Closure doWithSpring()

      Sub classes should override to provide implementations

      Returns:
        A closure that defines beans to be executed by Spring

    - #### org.springframework.context.ConfigurableApplicationContext getApplicationContext()

      Returns:
        The ApplicationContext

    - #### Config getConfig()

      Returns:
        The Config instance for this plugin

    - #### GrailsPluginManager getManager()

      The GrailsPluginManager instance

    - #### void onChange(java.util.Map<java.lang.String, java.lang.Object> event)

      Invoked when a object this plugin is watching changes

      Parameters:
        `event` - The event

    - #### @java.lang.Override void onConfigChange(java.util.Map<java.lang.String, java.lang.Object> event)

      Invoked when the application configuration changes

      Parameters:
        `event` - The event

    - #### @java.lang.Override void onShutdown(java.util.Map<java.lang.String, java.lang.Object> event)

      Invoked when the org.springframework.context.ApplicationContext is closed

      Parameters:
        `event` - The event

    - #### @java.lang.Override void onStartup(java.util.Map<java.lang.String, java.lang.Object> event)

    - #### @java.lang.Override void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)