api / org.gradle.api / NamedDomainObjectList

NamedDomainObjectList

interface NamedDomainObjectList<T : Any> : NamedDomainObjectCollection<T>, MutableList<T>

A specialisation of org.gradle.api.NamedDomainObjectCollection that also implements java.util.List.

All object equality is determined in terms of object names. That is, calling remove() with an object that is NOT equal to an existing object in terms of equals, but IS in terms of name equality will result in the existing collection item with the equal name being removed.

Parameters

- The type of element in the set

Functions

findAll

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

{@inheritDoc}

matching

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

{@inheritDoc}

withType

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

{@inheritDoc}

Inherited Functions

add

abstract fun add(element: T): Boolean

Adds an object to the collection, if there is no existing object in the collection with the same name.

addAll

abstract fun addAll(elements: Collection<T>): Boolean

Adds any of the given objects to the collection that do not have the same name as any existing element.

addRule

abstract fun addRule(rule: Rule): Rule

Adds a rule to this collection. The given rule is invoked when an unknown object is requested by name.

abstract fun addRule(description: String, ruleAction: Closure<Any>): Rule

Adds a rule to this collection. The given closure is executed when an unknown object is requested by name. The requested name is passed to the closure as a parameter.

abstract fun addRule(description: String, ruleAction: Action<String>): Rule

Adds a rule to this collection. The given action is executed when an unknown object is requested by name. The requested name is passed to the action.

findByName

abstract fun findByName(name: String): T

Locates an object by name, returning null if there is no such object.

getAsMap

abstract fun getAsMap(): SortedMap<String, T>

Returns the objects in this collection, as a map from object name to object instance.

The map is ordered by the natural ordering of the object names (i.e. keys).

getAt

abstract fun getAt(name: String): T

Locates an object by name, failing if there is no such task. This method is identical to . You can call this method in your build script by using the groovy [] operator.

getByName

abstract fun getByName(name: String): T

Locates an object by name, failing if there is no such object.

abstract fun getByName(name: String, configureClosure: Closure<Any>): T

Locates an object by name, failing if there is no such object. The given configure closure is executed against the object before it is returned from this method. The object is passed to the closure as its delegate.

abstract fun getByName(name: String, configureAction: Action<in T>): T

Locates an object by name, failing if there is no such object. The given configure action is executed against the object before it is returned from this method.

getNamer

abstract fun getNamer(): Namer<T>

An object that represents the naming strategy used to name objects of this collection.

getNames

abstract fun getNames(): SortedSet<String>

Returns the names of the objects in this collection as a Set of Strings.

The set of names is in natural ordering.

getRules

abstract fun getRules(): MutableList<Rule>

Returns the rules used by this collection.

Inheritors

ArtifactRepositoryContainer

interface ArtifactRepositoryContainer : NamedDomainObjectList<ArtifactRepository>, Configurable

A ResolverContainer is responsible for managing a set of ArtifactRepository instances. Repositories are arranged in a sequence.

You can obtain a ResolverContainer instance by calling org.gradle.api.Project#getRepositories() or using the repositories property in your build script.

The resolvers in a container are accessible as read-only properties of the container, using the name of the resolver as the property name. For example:

 repositories.maven { name 'myResolver' } repositories.myResolver.url = 'some-url' 

A dynamic method is added for each resolver which takes a configuration closure. This is equivalent to calling #getByName(String, groovy.lang.Closure). For example:

 repositories.maven { name 'myResolver' } repositories.myResolver { url 'some-url' }