Class Extensions


  • public final class Extensions
    extends java.lang.Object
    Helpers for working with extensions.
    Since:
    1.0.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <E> E findOrCreate​(org.gradle.api.plugins.ExtensionContainer extensions, java.lang.String name, java.lang.Class<? super E> publicType, java.lang.Class<E> implementationType)
      Find or create an extension by type from the provided container.
      static <E> E findOrCreate​(org.gradle.api.plugins.ExtensionContainer extensions, java.lang.String name, java.lang.Class<E> type)
      Find or create an extension by type from the provided container.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • findOrCreate

        public static <E> E findOrCreate​(org.gradle.api.plugins.ExtensionContainer extensions,
                                         java.lang.String name,
                                         java.lang.Class<E> type)
        Find or create an extension by type from the provided container.
        Type Parameters:
        E - extension type
        Parameters:
        extensions - extension container to search
        name - extension name
        type - type to create the extension under
        Returns:
        the new or existing extension instance
        Since:
        1.0.0
      • findOrCreate

        public static <E> E findOrCreate​(org.gradle.api.plugins.ExtensionContainer extensions,
                                         java.lang.String name,
                                         java.lang.Class<? super E> publicType,
                                         java.lang.Class<E> implementationType)
        Find or create an extension by type from the provided container.
        Type Parameters:
        E - extension type
        Parameters:
        extensions - extension container to search
        name - extension name
        publicType - type to expose to extension consumers
        implementationType - type to use to create the extension itsef
        Returns:
        the new or existing extension instance
        Since:
        1.0.0