BuildController (Gradle API 2.14.1)

Package: org.gradle.tooling

## [Java] Interface BuildController

- Provides a BuildAction various ways to control a Gradle build and access information about the build.

  Since:
    1.8

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `T` | `findModel(Class<T> modelType)` Fetches a snapshot of the model of the given type, if available.
    `T` | `findModel(Model target, Class<T> modelType)` Fetches a snapshot of the model of the given type, if available.
    `GradleBuild` | `getBuildModel()` Returns an overview of the Gradle build, including some basic details of the projects that make up the build.
    `T` | `getModel(Class<T> modelType)` Fetches a snapshot of the model of the given type for the default project.
    `T` | `getModel(Model target, Class<T> modelType)` Fetches a snapshot of the model of the given type for the given element, usually a Gradle project.

- - ### Method Detail

    - #### @Nullable public T findModel(Class<T> modelType)

      Fetches a snapshot of the model of the given type, if available.

      See getModel(Class) for more details.

      Parameters:
        `modelType` - The model type.
        `` - The model type.
      Returns:
        The model, or null if not present.

    - #### @Nullable public T findModel(Model target, Class<T> modelType)

      Fetches a snapshot of the model of the given type, if available.

      See getModel(Model, Class) for more details.

      Parameters:
        `modelType` - The model type.
        `` - The model type.
      Returns:
        The model, or null if not present.

    - #### public GradleBuild getBuildModel()

      Returns an overview of the Gradle build, including some basic details of the projects that make up the build. This is equivalent to calling `#getModel(GradleBuild.class)`.

      Returns:
        The model.

    - #### public T getModel(Class<T> modelType)

      Fetches a snapshot of the model of the given type for the default project. The default project is generally the project referenced when a ProjectConnection is created.

      Any of following models types may be available, depending on the version of Gradle being used by the target build:

      - GradleBuild
      - BuildEnvironment
      - GradleProject
      - BuildInvocations
      - ProjectPublications
      - IdeaProject
      - BasicIdeaProject
      - EclipseProject
      - HierarchicalEclipseProject

      A build may also expose additional custom tooling models. You can use this method to query these models.

      throws:
        UnknownModelException When the default project does not support the requested model.
      Parameters:
        `modelType` - The model type.
        `` - The model type.
      Returns:
        The model.
      Since:
        1.8

    - #### public T getModel(Model target, Class<T> modelType)

      Fetches a snapshot of the model of the given type for the given element, usually a Gradle project.

      The following elements are supported:

      - Any BasicGradleProject
      - Any GradleProject
      - Any EclipseProject
      - Any IdeaModule

      See getModel(Class) for more details.

      throws:
        UnknownModelException When the target project does not support the requested model.
      Parameters:
        `target` - The target element, usually a project.
        `modelType` - The model type.
        `` - The model type.
      Returns:
        The model.