|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD |
java.lang.Iterable org.gradle.api.DomainObjectCollection
public interface DomainObjectCollection extends Collection
A DomainObjectCollection is a specialised Collection that adds the ability to modification notifications and live filtered sub collections.
The filtered collections returned by the filtering methods, such as matching(Closure), return collections that are live. That is, they reflect changes made to the source collection that they were created from. This is true for filtered collections made from filtered collections etc.
You can also add actions which are executed as elements are added to the collection. Actions added to filtered collections will be fired if an addition/removal occurs for the source collection that matches the filter.
- The type of domain objects in this collection.Method Summary | |
---|---|
void
|
all(Action action)
Executes the given action against all objects in this collection, and any objects subsequently added to this collection. |
void
|
all(Closure action)
Executes the given closure against all objects in this collection, and any objects subsequently added to this collection. |
Collection
|
findAll(Closure spec)
Returns a collection which contains the objects in this collection which meet the given closure specification. |
DomainObjectCollection
|
matching(Spec spec)
Returns a collection which contains the objects in this collection which meet the given specification. |
DomainObjectCollection
|
matching(Closure spec)
Returns a collection which contains the objects in this collection which meet the given closure specification. |
Action
|
whenObjectAdded(Action action)
Adds an Action to be executed when an object is added to this collection. |
void
|
whenObjectAdded(Closure action)
Adds a closure to be called when an object is added to this collection. |
Action
|
whenObjectRemoved(Action action)
Adds an Action to be executed when an object is removed from this collection. |
void
|
whenObjectRemoved(Closure action)
Adds a closure to be called when an object is removed from this collection. |
DomainObjectCollection
|
withType(Class type)
Returns a collection containing the objects in this collection of the given type. |
DomainObjectCollection
|
withType(Class type, Action configureAction)
Returns a collection containing the objects in this collection of the given type. |
DomainObjectCollection
|
withType(Class type, Closure configureClosure)
Returns a collection containing the objects in this collection of the given type. |
Methods inherited from interface Collection | |
---|---|
add, equals, hashCode, clear, contains, isEmpty, size, toArray, toArray, addAll, iterator, remove, containsAll, removeAll, retainAll |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Method Detail |
---|
public void all(Action action)
action
- The action to be executed
public void all(Closure action)
action
- The action to be executed
public Collection findAll(Closure spec)
spec
- The specification to use. The closure gets a collection element as an argument.
public DomainObjectCollection matching(Spec spec)
spec
- The specification to use.
public DomainObjectCollection matching(Closure spec)
spec
- The specification to use. The closure gets a collection element as an argument.
public Action whenObjectAdded(Action action)
action
- The action to be executed
public void whenObjectAdded(Closure action)
action
- The closure to be called
public Action whenObjectRemoved(Action action)
action
- The action to be executed
public void whenObjectRemoved(Closure action)
action
- The closure to be called
public DomainObjectCollection withType(Class type)
type
- The type of objects to find.
public DomainObjectCollection withType(Class type, Action configureAction)
type
- The type of objects to find.configureAction
- The action to execute for each object in the resulting collection.
public DomainObjectCollection withType(Class type, Closure configureClosure)
type
- The type of objects to find.configureClosure
- The closure to execute for each object in the resulting collection.
Gradle API 1.12