Groovy Documentation

org.gradle.tooling
[Java] Interface ProjectConnection


public interface ProjectConnection

Represents a long-lived connection to a Gradle project. You obtain an instance of a ProjectConnection by using GradleConnector.connect.

Thread safety

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

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


Method Summary
void close()

Closes this connection.

java.lang.Object getModel(java.lang.Class viewType)

Fetches a snapshot of the model of the given type for this project.

void getModel(java.lang.Class viewType, ResultHandler handler)

Fetches a snapshot of the model for this project asynchronously.

ModelBuilder model(java.lang.Class modelType)

Creates a builder which can be used to build the model of the given type.

BuildLauncher newBuild()

Creates a launcher which can be used to execute a build.

 

Method Detail

close

public void close()
Closes this connection. Blocks until any pending operations are complete. Once this method has returned, no more notifications will be delivered by any threads.


getModel

public java.lang.Object getModel(java.lang.Class viewType)
Fetches a snapshot of the model of the given type for this project.

This method blocks until the model is available.

throws:
UnsupportedVersionException When the target Gradle version does not support the given model.
throws:
BuildException On some failure executing the Gradle build, in order to build the model.
throws:
GradleConnectionException On some other failure using the connection.
throws:
IllegalStateException When this connection has been closed or is closing.
Parameters:
viewType - The model type.
- The model type.
Returns:
The model.


getModel

public void getModel(java.lang.Class viewType, ResultHandler handler)
Fetches a snapshot of the model for this project asynchronously. This method return immediately, and the result of the operation is passed to the supplied result handler.
throws:
IllegalStateException When this connection has been closed or is closing.
Parameters:
viewType - The model type.
handler - The handler to pass the result to.
- The model type.


model

public ModelBuilder model(java.lang.Class modelType)
Creates a builder which can be used to build the model of the given type.
Parameters:
modelType - The model type
- The model type.
Returns:
The builder.


newBuild

public BuildLauncher newBuild()
Creates a launcher which can be used to execute a build.
Returns:
The launcher.


 

Groovy Documentation