api / org.gradle.model / ModelMap / withType

withType

abstract fun <S : Any> withType(type: Class<S>): ModelMap<S>

Returns a collection containing the items from this collection which are of the specified type.

Parameters

type - The type.

- The type.

Return
The collection.

abstract fun <S : Any> withType(type: Class<S>, configAction: Action<in S>): Unit

Applies the given action to each item of the given type in the collection, as each item is required.

The given action is invoked to configure the item when the item is required. It is called after any actions provided to #beforeEach(org.gradle.api.Action) and #create(String, * org.gradle.api.Action).

Parameters

type - The type of elements to apply the action to.

configAction - An action that configures the item. The action is executed when the item is required.

abstract fun <S : Any> withType(type: Class<S>, rules: Class<out RuleSource>): Unit

Applies the given rules to all items of the collection of the given type.

Parameters

type - the type that the item must be/implement to have the rules applied

rules - rules to apply