gradle
8.6

# withType

inline fun <S : Any> DomainObjectCollection<in S>.withType(noinline configuration: S.() -> Unit): DomainObjectCollection<S>(source)

Returns a collection containing the objects in this collection of the given type. Equivalent to calling `withType(type).all(configureAction)`.

#### Return

The matching objects. Returns an empty collection if there are no such objects in this collection.

#### Parameters

S

The type of objects to find.

configuration

The action to execute for each object in the resulting collection.

#### See also

DomainObjectCollection.withType

inline fun <S : Any> DomainObjectCollection<in S>.withType(): DomainObjectCollection<S>(source)

Returns a collection containing the objects in this collection of the given type. The returned collection is live, so that when matching objects are later added to this collection, they are also visible in the filtered collection.

#### Return

The matching objects. Returns an empty collection if there are no such objects in this collection.

#### Parameters

S

The type of objects to find.

#### See also

DomainObjectCollection.withType

inline fun <S : Any> NamedDomainObjectCollection<in S>.withType(): NamedDomainObjectCollection<S>(source)

Returns a collection containing the objects in this collection of the given type. The returned collection is live, so that when matching objects are later added to this collection, they are also visible in the filtered collection.

#### Return

The matching objects. Returns an empty collection if there are no such objects in this collection.

#### Parameters

S

The type of objects to find.

#### See also

NamedDomainObjectCollection.withType

inline fun <S : Task> TaskCollection<in S>.withType(): TaskCollection<S>(source)

Returns a collection containing the objects in this collection of the given type. The returned collection is live, so that when matching objects are later added to this collection, they are also visible in the filtered collection.

#### Return

The matching objects. Returns an empty collection if there are no such objects in this collection.

#### Parameters

S

The type of objects to find.

#### See also

TaskCollection.withType

inline fun <S : T, T : Any> NamedDomainObjectSet<T>.withType(type: KClass<S>): NamedDomainObjectSet<S>(source)
inline fun <S : T, T : Any> NamedDomainObjectSet<T>.withType(type: KClass<S>): NamedDomainObjectSet<S>(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.NamedDomainObjectSet.withType.

#### See also

NamedDomainObjectSet.withType

inline fun <S : T, T : Task> TaskCollection<T>.withType(type: KClass<S>): TaskCollection<S>(source)
inline fun <S : T, T : Task> TaskCollection<T>.withType(type: KClass<S>): TaskCollection<S>(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.tasks.TaskCollection.withType.

#### See also

TaskCollection.withType

inline fun <S : T, T : Any> DomainObjectSet<T>.withType(type: KClass<S>): DomainObjectSet<S>(source)
inline fun <S : T, T : Any> DomainObjectSet<T>.withType(type: KClass<S>): DomainObjectSet<S>(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.DomainObjectSet.withType.

#### See also

DomainObjectSet.withType

inline fun <S : T, T : Plugin<*>> PluginCollection<T>.withType(type: KClass<S>): PluginCollection<S>(source)
inline fun <S : T, T : Plugin<*>> PluginCollection<T>.withType(type: KClass<S>): PluginCollection<S>(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.plugins.PluginCollection.withType.

#### See also

PluginCollection.withType

inline fun <S : T, T : Any> NamedDomainObjectCollection<T>.withType(type: KClass<S>): NamedDomainObjectCollection<S>(source)
inline fun <S : T, T : Any> NamedDomainObjectCollection<T>.withType(type: KClass<S>): NamedDomainObjectCollection<S>(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.NamedDomainObjectCollection.withType.

#### See also

NamedDomainObjectCollection.withType

inline fun <S : T, T : Any> DomainObjectCollection<T>.withType(type: KClass<S>): DomainObjectCollection<S>(source)
inline fun <S : T, T : Any> DomainObjectCollection<T>.withType(type: KClass<S>): DomainObjectCollection<S>(source)
inline fun <S : T, T : Any> DomainObjectCollection<T>.withType(type: KClass<S>, configureAction: Action<in S>): DomainObjectCollection<S>(source)
inline fun <S : T, T : Any> DomainObjectCollection<T>.withType(type: KClass<S>, configureAction: Action<in S>): DomainObjectCollection<S>(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.DomainObjectCollection.withType.

#### See also

DomainObjectCollection.withType

inline fun <S : T, T : Any> NamedDomainObjectList<T>.withType(type: KClass<S>): NamedDomainObjectList<S>(source)
inline fun <S : T, T : Any> NamedDomainObjectList<T>.withType(type: KClass<S>): NamedDomainObjectList<S>(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.NamedDomainObjectList.withType.

#### See also

NamedDomainObjectList.withType

@Incubating
inline fun <S : Any, T : Any> ModelMap<T>.withType(type: KClass<S>): ModelMap<S>(source)
@Incubating
inline fun <S : Any, T : Any> ModelMap<T>.withType(type: KClass<S>): ModelMap<S>(source)
@Incubating
inline fun <S : Any, T : Any> ModelMap<T>.withType(type: KClass<S>, configAction: Action<in S>)(source)
@Incubating
inline fun <S : Any, T : Any> ModelMap<T>.withType(type: KClass<S>, configAction: Action<in S>)(source)
@Incubating
inline fun <S : Any, T : Any> ModelMap<T>.withType(type: KClass<S>, rules: KClass<out RuleSource>)(source)
@Incubating
inline fun <S : Any, T : Any> ModelMap<T>.withType(type: KClass<S>, rules: KClass<out RuleSource>)(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.model.ModelMap.withType.

#### See also

ModelMap.withType