Interface PluginContainer

    • Method Detail

      • apply

        Plugin apply​(java.lang.String id)
        Has the same behavior as apply(Class) except that the plugin is specified via its id. Not all plugins have an id.
        Parameters:
        id - The id of the plugin to be applied.
        Returns:
        The plugin which has been used against the project.
      • apply

        <T extends Plugin> T apply​(java.lang.Class<T> type)
        Applies a plugin to the project. This usually means that the plugin uses the project API to add and modify the state of the project. This method can be called an arbitrary number of times for a particular plugin type. The plugin will be actually used only the first time this method is called.
        Parameters:
        type - The type of the plugin to be used
        Returns:
        The plugin which has been used against the project.
      • hasPlugin

        boolean hasPlugin​(java.lang.String id)
        Returns true if the container has a plugin with the given id, false otherwise.
        Parameters:
        id - The id of the plugin
      • hasPlugin

        boolean hasPlugin​(java.lang.Class<? extends Plugin> type)
        Returns true if the container has a plugin with the given type, false otherwise.
        Parameters:
        type - The type of the plugin
      • findPlugin

        @Nullable
        Plugin findPlugin​(java.lang.String id)
        Returns the plugin for the given id.
        Parameters:
        id - The id of the plugin
        Returns:
        the plugin or null if no plugin for the given id exists.
      • findPlugin

        @Nullable
        <T extends Plugin> T findPlugin​(java.lang.Class<T> type)
        Returns the plugin for the given type.
        Parameters:
        type - The type of the plugin
        Returns:
        the plugin or null if no plugin for the given type exists.
      • getPlugin

        Plugin getPlugin​(java.lang.String id)
                  throws UnknownPluginException
        Returns a plugin with the specified id if this plugin has been used in the project.
        Parameters:
        id - The id of the plugin
        Throws:
        UnknownPluginException - When there is no plugin with the given id.
      • getPlugin

        <T extends Plugin> T getPlugin​(java.lang.Class<T> type)
                                throws UnknownPluginException
        Returns a plugin with the specified type if this plugin has been used in the project.
        Parameters:
        type - The type of the plugin
        Throws:
        UnknownPluginException - When there is no plugin with the given type.
      • getAt

        Plugin getAt​(java.lang.String id)
              throws UnknownPluginException
        Returns a plugin with the specified id if this plugin has been used in the project. You can use the Groovy [] operator to call this method from a build script.
        Parameters:
        id - The id of the plugin
        Throws:
        UnknownPluginException - When there is no plugin with the given id.
      • getAt

        <T extends Plugin> T getAt​(java.lang.Class<T> type)
                            throws UnknownPluginException
        Returns a plugin with the specified type if this plugin has been used in the project. You can use the Groovy [] operator to call this method from a build script.
        Parameters:
        type - The type of the plugin
        Throws:
        UnknownPluginException - When there is no plugin with the given type.
      • withId

        void withId​(java.lang.String pluginId,
                    Action<? super Plugin> action)
        Executes or registers an action for a plugin with given id. If the plugin was already applied, the action is executed. If the plugin is applied sometime later the action will be executed after the plugin is applied. If the plugin is never applied, the action is never executed. The behavior is similar to DomainObjectCollection.withType(Class, org.gradle.api.Action).
        Parameters:
        pluginId - the id of the plugin
        action - the action