org.gradle.tooling
Interface ModelBuilder<T extends Project>

Type Parameters:
T - The type of model to build

public interface ModelBuilder<T extends Project>

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

You use a ModelBuilder as follows:

Instances of ModelBuilder are not thread-safe.


Method Summary
 ModelBuilder<T> 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<? super T> handler)
          Starts fetching the build.
 ModelBuilder<T> setStandardError(OutputStream outputStream)
          Sets the OutputStream which should receive standard error logging generated while building the model.
 ModelBuilder<T> setStandardOutput(OutputStream outputStream)
          Sets the OutputStream which should receive standard output logging generated while building the model.
 

Method Detail

setStandardOutput

ModelBuilder<T> setStandardOutput(OutputStream outputStream)
Sets the 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

setStandardError

ModelBuilder<T> setStandardError(OutputStream outputStream)
Sets the 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

addProgressListener

ModelBuilder<T> 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

T get()
                      throws GradleConnectionException
Fetch the model, blocking until it is available.

Returns:
The model.
Throws:
UnsupportedVersionException - When the target Gradle version does not support the features required to build this model.
BuildException - On some failure executing the Gradle build.
GradleConnectionException - On some other failure using the connection.
IllegalStateException - When the connection has been closed or is closing.

get

void get(ResultHandler<? super T> handler)
         throws IllegalStateException
Starts fetching the build. This method returns immediately, and the result is later passed to the given handler.

Parameters:
handler - The handler to supply the result to.
Throws:
IllegalStateException - When the connection has been closed or is closing.