# getModel

abstract fun <T> getModel(modelType: Class<T>): T

Fetches a snapshot of the model of the given type for this project. This method blocks until the model is available.

This method is simply a convenience for calling `model(modelType).get()`

#### Return

The model.

#### Since

1.0-milestone-3

#### Parameters

modelType

The model type.

<T>

The model type.

#### Throws

UnsupportedVersionException

When the target Gradle version does not support the given model.

UnknownModelException

When the target Gradle version or build does not support the requested model.

BuildException

On some failure executing the Gradle build, in order to build the model.

GradleConnectionException

On some other failure using the connection.

IllegalStateException

When this connection has been closed or is closing.

abstract fun <T> getModel(modelType: Class<T>, handler: ResultHandler<in T>)

Starts fetching a snapshot of the given model, passing the result to the given handler when complete. This method returns immediately, and the result is later passed to the given handler's onComplete method.

If the operation fails, the handler's onFailure method is called with the appropriate exception. See getModel for a description of the various exceptions that the operation may fail with.

This method is simply a convenience for calling `model(modelType).get(handler)`

#### Since

1.0-milestone-3

#### Parameters

modelType

The model type.

handler

The handler to pass the result to.

<T>

The model type.

#### Throws

IllegalStateException

When this connection has been closed or is closing.