Groovy Documentation

org.gradle.api.plugins
[Java] Interface Convention

org.gradle.api.plugins.Convention
  org.gradle.api.plugins.ExtensionContainer
All Superinterfaces:
ExtensionContainer

public interface Convention
extends ExtensionContainer

A Convention manages a set of convention objects. When you add a convention object to a Convention, 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, a Convention is used by plugins to extend a Project or a Task.


Method Summary
Object findPlugin(Class type)

Locates the plugin convention object with the given type.

DynamicObject getExtensionsAsDynamicObject()

Returns a dynamic object which represents the properties and methods contributed by the extensions and convention objects contained in this convention.

Object getPlugin(Class type)

Locates the plugin convention object with the given type.

Map getPlugins()

Returns the plugin convention objects contained in this convention.

 
Methods inherited from interface ExtensionContainer
add, add, configure, create, findByName, findByType, getByName, getByType, getExtraProperties
 

Method Detail

findPlugin

public Object findPlugin(Class type)
Locates the plugin convention object with the given type.
throws:
IllegalStateException When there there are multiple matching objects.
Parameters:
type - The convention object type.
Returns:
The object. Returns null if there is no such object.


getExtensionsAsDynamicObject

public 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


getPlugin

public Object getPlugin(Class type)
Locates the plugin convention object with the given type.
throws:
IllegalStateException When there is no such object contained in this convention, or when there are multiple such objects.
Parameters:
type - The convention object type.
Returns:
The object. Never returns null.


getPlugins

public Map 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.


 

Gradle API 1.12