Groovy Documentation

org.gradle.api
[Java] Interface NamedDomainObjectCollection

org.gradle.api.NamedDomainObjectCollection
  org.gradle.api.DomainObjectCollection
All Superinterfaces:
DomainObjectCollection

public interface NamedDomainObjectCollection
extends DomainObjectCollection

A NamedDomainObjectCollection represents a read-only set of domain objects of type T. Each domain object in this collection has a name, which uniquely identifies the object in this collection.

Each object in a collection are accessible as read-only properties of the collection, using the name of the object as the property name. For example:

 tasks.add('myTask')
 tasks.myTask.dependsOn someOtherTask
 

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

 tasks.add('myTask')
 tasks.myTask {
     dependsOn someOtherTask
 }
 

You can also use the [] operator to access the objects of a collection by name. For example:

 tasks.add('myTask')
 tasks['myTask'].dependsOn someOtherTask
 
Parameters:
- The type of domain objects in this collection.


Method Summary
 
Methods inherited from interface java.lang.Iterable
java.lang.Iterable#iterator()
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Groovy Documentation