Package org.gradle.api.plugins
Interface Convention
-
- All Superinterfaces:
ExtensionContainer
public interface Convention extends ExtensionContainer
A
Conventionmanages a set of convention objects. When you add a convention object to aConvention, and the properties and methods of the convention object become available as properties and methods of the object which the convention is associated to. A convention object is simply a POJO or POGO. Usually, aConventionis used by plugins to extend aProjector aTask.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TfindPlugin(Class<T> type)Locates the plugin convention object with the given type.org.gradle.internal.metaobject.DynamicObjectgetExtensionsAsDynamicObject()Returns a dynamic object which represents the properties and methods contributed by the extensions and convention objects contained in this convention.<T> TgetPlugin(Class<T> type)Locates the plugin convention object with the given type.Map<String,Object>getPlugins()Returns the plugin convention objects contained in this convention.-
Methods inherited from interface org.gradle.api.plugins.ExtensionContainer
add, add, add, configure, configure, configure, create, create, create, findByName, findByType, findByType, getByName, getByType, getByType, getExtensionsSchema, getExtraProperties, getSchema
-
-
-
-
Method Detail
-
getPlugins
Map<String,Object> getPlugins()
Returns the plugin convention objects contained in this convention.- Returns:
- The plugins. Returns an empty map when this convention does not contain any convention objects.
-
getPlugin
<T> T getPlugin(Class<T> type) throws IllegalStateException
Locates the plugin convention object with the given type.- Parameters:
type- The convention object type.- Returns:
- The object. Never returns null.
- Throws:
IllegalStateException- When there is no such object contained in this convention, or when there are multiple such objects.
-
findPlugin
@Nullable <T> T findPlugin(Class<T> type) throws IllegalStateException
Locates the plugin convention object with the given type.- Parameters:
type- The convention object type.- Returns:
- The object. Returns null if there is no such object.
- Throws:
IllegalStateException- When there are multiple matching objects.
-
getExtensionsAsDynamicObject
org.gradle.internal.metaobject.DynamicObject getExtensionsAsDynamicObject()
Returns a dynamic object which represents the properties and methods contributed by the extensions and convention objects contained in this convention.- Returns:
- The dynamic object
-
-