org.gradle.tooling
Interface BuildConnection


public interface BuildConnection

Represents a long-lived connection to a Gradle build.

Thread safety

All implementations of GradleConnection are thread-safe, and may be shared by any number of threads.

All notifications from a given GradleConnection instance are delivered by a single thread at a time. Note, however, that the delivery thread may change over time.


Method Summary
<T extends Build>
T
getModel(Class<T> viewType)
          Fetches a snapshot of the model for this build.
<T extends Build>
void
getModel(Class<T> viewType, ResultHandler<? super T> handler)
          Fetches a snapshot of the model for this build asynchronously.
 

Method Detail

getModel

<T extends Build> T getModel(Class<T> viewType)
                         throws GradleConnectionException
Fetches a snapshot of the model for this build. This method blocks until the model is available.

Type Parameters:
T - The model type.
Parameters:
viewType - The model type.
Returns:
The model.
Throws:
UnsupportedVersionException - When the target Gradle version does not support the given model.
GradleConnectionException - On some failure to communicate with Gradle.

getModel

<T extends Build> void getModel(Class<T> viewType,
                                ResultHandler<? super T> handler)
Fetches a snapshot of the model for this build asynchronously. This method return immediately, and the result of the operation is passed to the supplied result handler.

Type Parameters:
T - The model type.
Parameters:
viewType - The model type.
handler - The handler to pass the result to.