gradle
8.5

# findModel

@Nullable
abstract fun <T> findModel(modelType: Class<T>): T(source)
@Nullable
abstract fun <T> findModel(target: Model, modelType: Class<T>): 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.

#### Parameters

modelType

The model type.

<T>

The model type.

@Nullable
abstract fun <T, P> findModel(modelType: Class<T>, parameterType: Class<P>, parameterInitializer: Action<out Any>): 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.

#### 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<out Any>): 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.

#### 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