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 and 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 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.
|
matching, matching, whenPluginAdded, whenPluginAdded, withType
findAll
all, all, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType
Plugin apply(String id)
apply(Class)
except that the 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 pluginPlugin findPlugin(String id)
id
- The id of the plugin<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.@Incubating void withId(String pluginId, Action<? super Plugin> action)
DomainObjectCollection.withType(Class, org.gradle.api.Action)
.pluginId
- the id of the pluginaction
- the action