Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.gradle.tooling
[Java] Interface ModelBuilder

    public interface ModelBuilder

A `ModelBuilder` allows you to fetch a snapshot of the model for a project.

You use a `ModelBuilder` as follows:

- Create an instance of `ModelBuilder` by calling ProjectConnection.model.
- Configure the builder as appropriate.
- Call either get() or get(ResultHandler) to build the model.
- Optionally, you can reuse the builder to build the model multiple times.

Instances of `ModelBuilder` are not thread-safe.

Parameters:
  `` - The type of model to build

Method Summary
`ModelBuilder` | `addProgressListener(ProgressListener listener)` Adds a progress listener which will receive progress events as the model is being built.
`T` | `get()` Fetch the model, blocking until it is available.
`void` | `get(ResultHandler handler)` Starts fetching the build.
`ModelBuilder` | `setStandardError(java.io.OutputStream outputStream)` Sets the java.io.OutputStream which should receive standard error logging generated while building the model.
`ModelBuilder` | `setStandardOutput(java.io.OutputStream outputStream)` Sets the java.io.OutputStream which should receive standard output logging generated while building the model.

Method Detail

### addProgressListener

    public ModelBuilder addProgressListener(ProgressListener listener)

  Adds a progress listener which will receive progress events as the model is being built.
  Parameters:
    `listener` - The listener
  Returns:
    this

### get

    public T get()

  Fetch the model, blocking until it is available.
  throws:
    UnsupportedVersionException When the target Gradle version does not support the features required to build this model.
  throws:
    BuildException On some failure executing the Gradle build.
  throws:
    GradleConnectionException On some other failure using the connection.
  throws:
    IllegalStateException When the connection has been closed or is closing.
  Returns:
    The model.

### get

    public void get(ResultHandler handler)

  Starts fetching the build. This method returns immediately, and the result is later passed to the given handler.
  throws:
    IllegalStateException When the connection has been closed or is closing.
  Parameters:
    `handler` - The handler to supply the result to.

### setStandardError

    public ModelBuilder setStandardError(java.io.OutputStream outputStream)

  Sets the java.io.OutputStream which should receive standard error logging generated while building the model. The default is to discard the output.
  Parameters:
    `outputStream` - The output stream.
  Returns:
    this

### setStandardOutput

    public ModelBuilder setStandardOutput(java.io.OutputStream outputStream)

  Sets the java.io.OutputStream which should receive standard output logging generated while building the model. The default is to discard the output.
  Parameters:
    `outputStream` - The output stream.
  Returns:
    this

Groovy Documentation