For AI agents: the documentation index is at https://docs.gradle.org/llms.txt. Request any page with the header Accept: text/markdown to get Markdown. User manual pages are also available as Markdown by replacing .html with .md in the URL.

findModel

@Nullable
abstract fun <T> findModel(modelType: Class<T>): @Nullable T(source)
@Nullable
abstract fun <T> findModel(target: Model, modelType: Class<T>): @Nullable T(source)

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

See getModel for more details.

Return

The model, or null if not present.

Since

1.8

Parameters

modelType

The model type.

<T>

The model type.


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

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

See getModel for more details.

Return

The model.

Since

4.4

Parameters

modelType

The model type.

<T>

The model type.

parameterType

The parameter type.

<P>

The parameter type.

parameterInitializer

Action to configure the parameter


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

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

See getModel for more details.

Return

The model.

Since

4.4

Parameters

target

The target element, usually a project.

modelType

The model type.

<T>

The model type.

parameterType

The parameter type.

<P>

The parameter type.

parameterInitializer

Action to configure the parameter