Package: org.gradle.api.plugins

## [Java] Interface PluginCollection<T>

- java.util.Collection

- All Superinterfaces:
    DomainObjectSet, Iterable, DomainObjectCollection, Collection

  A `PluginCollection` represents a collection of Plugin instances.

  Parameters:
    `` - The type of plugins which this collection contains.

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `PluginCollection<T>` | `matching(Spec<? super T> spec)` {@inheritDoc}
    `PluginCollection<T>` | `matching(Closure closure)` {@inheritDoc}
    `Action<? super T>` | `whenPluginAdded(Action<? super T> action)` Adds an `Action` to be executed when a plugin is added to this collection.
    `void` | `whenPluginAdded(Closure closure)` Adds a closure to be called when a plugin is added to this collection.
    `PluginCollection<S>` | `withType(Class<S> type)` {@inheritDoc}

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `interface DomainObjectSet` | `findAll, matching, matching, withType`
    `interface DomainObjectCollection` | `all, all, findAll, matching, matching, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType, withType`
    `interface Set` | `add, equals, hashCode, clear, contains, isEmpty, size, toArray, toArray, addAll, iterator, remove, containsAll, removeAll, retainAll`

- - ### Method Detail

    - #### public PluginCollection<T> matching(Spec<? super T> spec)

      {@inheritDoc}

    - #### public PluginCollection<T> matching(Closure closure)

      {@inheritDoc}

    - #### @SuppressWarnings("UnusedDeclaration") public Action<? super T> whenPluginAdded(Action<? super T> action)

      Adds an `Action` to be executed when a plugin is added to this collection.

      Parameters:
        `action` - The action to be executed
      Returns:
        the supplied action

    - #### @SuppressWarnings("UnusedDeclaration") public void whenPluginAdded(Closure closure)

      Adds a closure to be called when a plugin is added to this collection. The plugin is passed to the closure as the parameter.

      Parameters:
        `closure` - The closure to be called

    - #### public PluginCollection<S> withType(Class<S> type)

      {@inheritDoc}