api / org.gradle.api / DomainObjectSet

DomainObjectSet

interface DomainObjectSet<T : Any> : DomainObjectCollection<T>, MutableSet<T>

A DomainObjectSet is a specialisation of DomainObjectCollection that guarantees Set semantics.

Parameters

- The type of domain objects in this set.

Functions

findAll

abstract fun findAll(spec: Closure<Any>): MutableSet<T>

{@inheritDoc}

matching

abstract fun matching(spec: Spec<in T>): DomainObjectSet<T>
abstract fun matching(spec: Closure<Any>): DomainObjectSet<T>

{@inheritDoc}

withType

abstract fun <S : T> withType(type: Class<S>): DomainObjectSet<S>

{@inheritDoc}

Inherited Functions

addLater

abstract fun addLater(provider: Provider<out T>): Unit

Adds an element to this collection, given a Provider that will provide the element when required. Note: this method currently has a placeholder name and will almost certainly be renamed.

all

abstract fun all(action: Action<in T>): Unit

Executes the given action against all objects in this collection, and any objects subsequently added to this collection.

abstract fun all(action: Closure<Any>): Unit

Executes the given closure against all objects in this collection, and any objects subsequently added to this collection. The object is passed to the closure as the closure delegate. Alternatively, it is also passed as a parameter.

configureEach

abstract fun configureEach(action: Action<in T>): Unit

Configures each element in this collection using the given action, as each element is required. Actions are run in the order added.

whenObjectAdded

abstract fun whenObjectAdded(action: Action<in T>): Action<in T>

Adds an Action to be executed when an object is added to this collection.

abstract fun whenObjectAdded(action: Closure<Any>): Unit

Adds a closure to be called when an object is added to this collection. The newly added object is passed to the closure as the parameter.

whenObjectRemoved

abstract fun whenObjectRemoved(action: Action<in T>): Action<in T>

Adds an Action to be executed when an object is removed from this collection.

abstract fun whenObjectRemoved(action: Closure<Any>): Unit

Adds a closure to be called when an object is removed from this collection. The removed object is passed to the closure as the parameter.

withType

abstract fun <S : T> withType(type: Class<S>, configureAction: Action<in S>): DomainObjectCollection<S>

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

abstract fun <S : T> withType(type: Class<S>, configureClosure: Closure<Any>): DomainObjectCollection<S>

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

Inheritors

BinaryTasksCollection

interface BinaryTasksCollection : DomainObjectSet<Task>

A collection of tasks associated to a binary

DependencyConstraintSet

interface DependencyConstraintSet : DomainObjectSet<DependencyConstraint>

A set of dependency constraint definitions that are associated with a configuration.

DependencySet

interface DependencySet : DomainObjectSet<Dependency>, Buildable

A set of artifact dependencies.

IvyArtifactSet

interface IvyArtifactSet : DomainObjectSet<IvyArtifact>

A Collection of IvyArtifacts to be included in an IvyPublication. Being a DomainObjectSet, a IvyArtifactSet provides convenient methods for querying, filtering, and applying actions to the set of IvyArtifacts.

 apply plugin: 'ivy-publish' def publication = publishing.publications.create("my-pub", IvyPublication) def artifacts = publication.artifacts artifacts.matching({ it.type == "source" }).all({ it.extension = "src.jar" }) 

MavenArtifactSet

interface MavenArtifactSet : DomainObjectSet<MavenArtifact>

A Collection of MavenArtifacts to be included in a MavenPublication. Being a DomainObjectSet, a MavenArtifactSet provides convenient methods for querying, filtering, and applying actions to the set of MavenArtifacts.

 apply plugin: 'maven-publish' def publication = publishing.publications.create("name", MavenPublication) def artifacts = publication.artifacts artifacts.matching({ it.classifier == "classy" }).all({ it.extension = "ext" }) 

PluginCollection

interface PluginCollection<T : Plugin<Any>> : DomainObjectSet<T>

A PluginCollection represents a collection of org.gradle.api.Plugin instances.

ProjectSourceSet

interface ProjectSourceSet : DomainObjectSet<LanguageSourceSet>

A container of org.gradle.language.base.LanguageSourceSets. Added to a project by the org.gradle.language.base.plugins.LanguageBasePlugin.

PublishArtifactSet

interface PublishArtifactSet : DomainObjectSet<PublishArtifact>, Buildable

A set of artifacts to be published.