Collection<Plugin>, DomainObjectCollection<Plugin>, DomainObjectSet<Plugin>, Iterable<Plugin>, PluginCollection<Plugin>, Set<Plugin>public interface PluginContainer extends PluginCollection<Plugin>
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.
| Modifier and Type | Method | Description |
|---|---|---|
<T extends Plugin> |
apply(Class<T> type) |
Applies a plugin to the project.
|
Plugin |
apply(String id) |
Has the same behavior as
apply(Class) except that the plugin is specified via its id. |
<T extends Plugin> |
findPlugin(Class<T> type) |
Returns the plugin for the given type.
|
Plugin |
findPlugin(String id) |
Returns the plugin for the given id.
|
<T extends Plugin> |
getAt(Class<T> type) |
Returns a plugin with the specified type if this plugin has been used in the project.
|
Plugin |
getAt(String id) |
Returns a plugin with the specified id if this plugin has been used in the project.
|
<T extends Plugin> |
getPlugin(Class<T> type) |
Returns a plugin with the specified type if this plugin has been used in the project.
|
Plugin |
getPlugin(String id) |
Returns a plugin with the specified id if this plugin has been used in the project.
|
boolean |
hasPlugin(Class<? extends Plugin> type) |
Returns true if the container has a plugin with the given type, false otherwise.
|
boolean |
hasPlugin(String id) |
Returns true if the container has a plugin with the given id, false otherwise.
|
void |
withId(String pluginId,
Action<? super Plugin> action) |
Executes or registers an action for a plugin with given id.
|
parallelStream, removeIf, stream, toArrayaddAllLater, addLater, all, all, configureEach, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withTypefindAlladd, addAll, clear, matching, matching, remove, removeAll, whenPluginAdded, whenPluginAdded, withTypePlugin apply(String id)
apply(Class) except that the plugin is specified via its id. Not all
plugins have an id.id - The id of the plugin to be applied.<T extends Plugin> T apply(Class<T> type)
type - The type of the plugin to be usedboolean hasPlugin(String id)
id - The id of the pluginboolean hasPlugin(Class<? extends Plugin> type)
type - The type of the plugin@Nullable Plugin findPlugin(String id)
id - The id of the plugin@Nullable <T extends Plugin> T findPlugin(Class<T> type)
type - The type of the pluginPlugin getPlugin(String id) throws UnknownPluginException
id - The id of the pluginUnknownPluginException - When there is no plugin with the given id.<T extends Plugin> T getPlugin(Class<T> type) throws UnknownPluginException
type - The type of the pluginUnknownPluginException - When there is no plugin with the given type.Plugin getAt(String id) throws UnknownPluginException
[] operator to call this method from a build script.id - The id of the pluginUnknownPluginException - When there is no plugin with the given id.<T extends Plugin> T getAt(Class<T> type) throws UnknownPluginException
[] operator to call this method from a build script.type - The type of the pluginUnknownPluginException - When there is no plugin with the given type.void withId(String pluginId, Action<? super Plugin> action)
DomainObjectCollection.withType(Class, org.gradle.api.Action).pluginId - the id of the pluginaction - the action