|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD |
java.lang.Iterable org.gradle.api.NamedDomainObjectSet org.gradle.api.DomainObjectCollection org.gradle.api.NamedDomainObjectContainer org.gradle.api.NamedDomainObjectCollection java.util.Collection
public interface NamedDomainObjectContainer extends org.gradle.util.Configurable, NamedDomainObjectSet
A named domain object container is a specialisation of NamedDomainObjectSet that adds the ability to create instances of the element type.
Implementations may use different strategies for creating new object instances.
Note that a container is an implementation of java.util.SortedSet, which means that the container is guaranteed to only contain elements with unique names within this container. Furthermore, items are ordered by their name.
- The type of domain objects in this container.Method Summary | |
---|---|
NamedDomainObjectContainer
|
configure(groovy.lang.Closure configureClosure)
|
java.lang.Object
|
create(java.lang.String name)
Creates a new item with the given name, adding it to this container. |
java.lang.Object
|
create(java.lang.String name, groovy.lang.Closure configureClosure)
Creates a new item with the given name, adding it to this container, then configuring it with the given closure. |
Methods inherited from interface org.gradle.util.Configurable | |
---|---|
org.gradle.util.Configurable#configure(groovy.lang.Closure) |
Methods inherited from interface NamedDomainObjectSet | |
---|---|
findAll, matching, matching, withType |
Methods inherited from interface NamedDomainObjectCollection | |
---|---|
add, addAll, addRule, addRule, findByName, getAsMap, getAt, getByName, getByName, getNamer, getRules, matching, matching, withType |
Methods inherited from interface DomainObjectCollection | |
---|---|
all, all, allObjects, allObjects, findAll, findAll, getAll, matching, matching, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType, withType |
Method Detail |
---|
public NamedDomainObjectContainer configure(groovy.lang.Closure configureClosure)
Allows the container to be configured, creating missing objects as they are referenced.
TODO: example usage
configureClosure
- The closure to configure this container with
public java.lang.Object create(java.lang.String name)
name
- The name to assign to the created object
public java.lang.Object create(java.lang.String name, groovy.lang.Closure configureClosure)
name
- The name to assign to the created objectconfigureClosure
- The closure to configure the created object with
Groovy Documentation