gradle
8.5

# withType

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

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

#### Return

The collection.

#### Parameters

type

The type.

<S>

The type.

abstract fun <S> withType(type: Class<S>, configAction: Action<out Any>)(source)

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 and create.

#### 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> withType(type: Class<S>, rules: Class<out RuleSource>)(source)

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