Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.gradle.api
[Java] Interface NamedDomainObjectContainer

    org.gradle.api.DomainObjectCollection
      org.gradle.api.NamedDomainObjectSet
          java.lang.Iterable
              org.gradle.api.NamedDomainObjectContainer
                  java.util.Collection
                      org.gradle.api.NamedDomainObjectCollection

All Superinterfaces:
  DomainObjectCollection, NamedDomainObjectSet, NamedDomainObjectCollection

    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.

Parameters:
  `` - The type of domain objects in this container.

See Also:
  NamedDomainObjectSet

Method Summary
`NamedDomainObjectContainer` | `configure(groovy.lang.Closure configureClosure)` Allows the container to be configured, creating missing objects as they are referenced.
`T` | `create(java.lang.String name)` Creates a new item with the given name, adding it to this container.
`T` | `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 NamedDomainObjectSet
matching, matching, withType

Methods inherited from interface org.gradle.util.Configurable
org.gradle.util.Configurable#configure(groovy.lang.Closure)

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), 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()

Method Detail

### configure

    public NamedDomainObjectContainer configure(groovy.lang.Closure configureClosure)

  Allows the container to be configured, creating missing objects as they are referenced.

  TODO: example usage

  Parameters:
    `configureClosure` - The closure to configure this container with
  Returns:
    This.

### create

    public T create(java.lang.String name)

  Creates a new item with the given name, adding it to this container.
  throws:
    InvalidUserDataException if an object with the given name already exists in this container.
  Parameters:
    `name` - The name to assign to the created object
  Returns:
    The created object. Never null.

### create

    public T 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.
  throws:
    InvalidUserDataException if an object with the given name already exists in this container.
  Parameters:
    `name` - The name to assign to the created object
    `configureClosure` - The closure to configure the created object with
  Returns:
    The created object. Never null.

Groovy Documentation