Convention (Gradle API 8.11)

Package org.gradle.api.plugins

## Interface Convention

- All Superinterfaces:
    `ExtensionContainer`

      @Deprecated
      public interface Convention
      extends ExtensionContainer

  Deprecated.
  Use extensions instead. This is scheduled for removal in Gradle 9.

  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`.

  See Also:
    `ExtensionAware`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `<T> T` | `findPlugin​(java.lang.Class<T> type)` | Deprecated. Use extensions instead.
    `org.gradle.internal.metaobject.DynamicObject` | `getExtensionsAsDynamicObject()` | Deprecated. Returns a dynamic object which represents the properties and methods contributed by the extensions and convention objects contained in this convention.
    `<T> T` | `getPlugin​(java.lang.Class<T> type)` | Deprecated. Use extensions instead.
    `java.util.Map<java.lang.String,​java.lang.Object>` | `getPlugins()` | Deprecated. Use extensions instead.

    - ### 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`

- - ### Method Detail

    - #### getPlugins

          @Deprecated
          java.util.Map<java.lang.String,​java.lang.Object> getPlugins()

      Deprecated.
      Use extensions instead. This is scheduled for removal in Gradle 9.
      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.
      See Also:
        `ExtensionAware`

    - #### getPlugin

          @Deprecated
          <T> T getPlugin​(java.lang.Class<T> type)
                   throws java.lang.IllegalStateException

      Deprecated.
      Use extensions instead. This is scheduled for removal in Gradle 9.
      Locates the plugin convention object with the given type.
      Parameters:
        `type` - The convention object type.
      Returns:
        The object. Never returns null.
      Throws:
        `java.lang.IllegalStateException` - When there is no such object contained in this convention, or when there are multiple such objects.
      See Also:
        `ExtensionAware`

    - #### findPlugin

          @Nullable
          @Deprecated
          <T> T findPlugin​(java.lang.Class<T> type)
                    throws java.lang.IllegalStateException

      Deprecated.
      Use extensions instead. This is scheduled for removal in Gradle 9.
      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:
        `java.lang.IllegalStateException` - When there are multiple matching objects.
      See Also:
        `ExtensionAware`

    - #### getExtensionsAsDynamicObject

          org.gradle.internal.metaobject.DynamicObject getExtensionsAsDynamicObject()

      Deprecated.
      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