Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.gradle.api.plugins
[Java] Interface PluginContainer

    org.gradle.api.plugins.PluginCollection
      org.gradle.api.plugins.PluginContainer
          java.lang.Iterable
              org.gradle.api.DomainObjectCollection
                  org.gradle.api.DomainObjectSet
                      java.util.Collection

All Superinterfaces:
  PluginCollection, DomainObjectCollection, DomainObjectSet

    public interface PluginContainer
    extends PluginCollection

A `PluginContainer` is used to manage a set of Plugin instances applied to a particular project.

Plugins can be specified using either an id or type. The id of a plugin is specified using a META-INF/gradle-plugins/${id}.properties classpath resource.

Authors:
  Hans Dockter

Method Summary
`Plugin` | `apply(java.lang.String id)` Has the same behavior as apply(Class) except that the the plugin is specified via its id.
`T` | `apply(java.lang.Class type)` Applies a plugin to the project.
`Plugin` | `findPlugin(java.lang.String id)` Returns the plugin for the given id.
`T` | `findPlugin(java.lang.Class type)` Returns the plugin for the given type.
`Plugin` | `getAt(java.lang.String id)` Returns a plugin with the specified id if this plugin has been used in the project.
`T` | `getAt(java.lang.Class type)` Returns a plugin with the specified type if this plugin has been used in the project.
`Plugin` | `getPlugin(java.lang.String id)` Returns a plugin with the specified id if this plugin has been used in the project.
`T` | `getPlugin(java.lang.Class type)` Returns a plugin with the specified type if this plugin has been used in the project.
`boolean` | `hasPlugin(java.lang.String id)` Returns true if the container has a plugin with the given id, false otherwise.
`boolean` | `hasPlugin(java.lang.Class type)` Returns true if the container has a plugin with the given type, false otherwise.

Methods inherited from interface PluginCollection
allPlugins, allPlugins, matching, matching, whenPluginAdded, whenPluginAdded, withType

Methods inherited from interface DomainObjectSet
findAll, matching, matching, withType

Methods inherited from interface DomainObjectCollection
all, all, allObjects, allObjects, findAll, findAll, getAll, matching, matching, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType, withType

Methods inherited from interface java.util.Set
java.util.Set#add(java.lang.Object), java.util.Set#equals(java.lang.Object), java.util.Set#hashCode(), java.util.Set#clear(), java.util.Set#size(), java.util.Set#isEmpty(), java.util.Set#contains(java.lang.Object), java.util.Set#addAll(java.util.Collection), java.util.Set#toArray(), java.util.Set#toArray([Ljava.lang.Object;), java.util.Set#iterator(), java.util.Set#remove(java.lang.Object), java.util.Set#removeAll(java.util.Collection), java.util.Set#containsAll(java.util.Collection), java.util.Set#retainAll(java.util.Collection)

Methods inherited from 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()

Method Detail

### apply

    public Plugin apply(java.lang.String id)

  Has the same behavior as apply(Class) except that the the plugin is specified via its id. Not all plugins have an id.
  Parameters:
    `id` - The id of the plugin to be applied.
  Returns:
    The plugin which has been used against the project.

### apply

    public T apply(java.lang.Class type)

  Applies a plugin to the project. This usually means that the plugin uses the project API to add and modify the state of the project. This method can be called an arbitrary number of times for a particular plugin type. The plugin will be actually used only the first time this method is called.
  Parameters:
    `type` - The type of the plugin to be used
  Returns:
    The plugin which has been used against the project.

### findPlugin

    public Plugin findPlugin(java.lang.String id)

  Returns the plugin for the given id.
  Parameters:
    `id` - The id of the plugin
  Returns:
    the plugin or null if no plugin for the given id exists.

### findPlugin

    public T findPlugin(java.lang.Class type)

  Returns the plugin for the given type.
  Parameters:
    `type` - The type of the plugin
  Returns:
    the plugin or null if no plugin for the given type exists.

### getAt

    public Plugin getAt(java.lang.String id)

  Returns a plugin with the specified id if this plugin has been used in the project. You can use the Groovy `[]` operator to call this method from a build script.
  throws:
    UnknownPluginException When there is no plugin with the given id.
  Parameters:
    `id` - The id of the plugin

### getAt

    public T getAt(java.lang.Class type)

  Returns a plugin with the specified type if this plugin has been used in the project. You can use the Groovy `[]` operator to call this method from a build script.
  throws:
    UnknownPluginException When there is no plugin with the given type.
  Parameters:
    `type` - The type of the plugin

### getPlugin

    public Plugin getPlugin(java.lang.String id)

  Returns a plugin with the specified id if this plugin has been used in the project.
  throws:
    UnknownPluginException When there is no plugin with the given id.
  Parameters:
    `id` - The id of the plugin

### getPlugin

    public T getPlugin(java.lang.Class type)

  Returns a plugin with the specified type if this plugin has been used in the project.
  throws:
    UnknownPluginException When there is no plugin with the given type.
  Parameters:
    `type` - The type of the plugin

### hasPlugin

    public boolean hasPlugin(java.lang.String id)

  Returns true if the container has a plugin with the given id, false otherwise.
  Parameters:
    `id` - The id of the plugin

### hasPlugin

    public boolean hasPlugin(java.lang.Class type)

  Returns true if the container has a plugin with the given type, false otherwise.
  Parameters:
    `type` - The type of the plugin

Groovy Documentation