api / org.gradle.tooling / BuildController / findModel

findModel

abstract fun <T : Any> findModel(modelType: Class<T>): T

Fetches a snapshot of the model of the given type, if available.

See #getModel(Class) for more details.

Parameters

modelType - The model type.

- The model type.

Return
The model, or null if not present.

abstract fun <T : Any> findModel(target: Model, modelType: Class<T>): T

Fetches a snapshot of the model of the given type, if available.

See #getModel(Model, Class) for more details.

Parameters

modelType - The model type.

- The model type.

Return
The model, or null if not present.

abstract fun <T : Any, P : Any> findModel(modelType: Class<T>, parameterType: Class<P>, parameterInitializer: Action<in P>): T

Fetches a snapshot of the model of the given type using the given parameter, if available.

See #getModel(Model, Class, Class, Action) for more details.

Parameters

modelType - The model type.

- The model type.

parameterType - The parameter type.

- The parameter type.

parameterInitializer - Action to configure the parameter

Return
The model.

Since
4.4

abstract fun <T : Any, P : Any> findModel(target: Model, modelType: Class<T>, parameterType: Class<P>, parameterInitializer: Action<in P>): T

Fetches a snapshot of the model of the given type for the given element using the given parameter, if available.

See #getModel(Model, Class, Class, Action) for more details.

Parameters

target - The target element, usually a project.

modelType - The model type.

- The model type.

parameterType - The parameter type.

- The parameter type.

parameterInitializer - Action to configure the parameter

Return
The model.

Since
4.4