public class DefaultDomainObjectCollection<T> extends java.util.AbstractCollection<T> implements DomainObjectCollection<T>
| Modifier | Constructor and Description |
|---|---|
|
DefaultDomainObjectCollection(java.lang.Class<? extends T> type,
java.util.Collection<T> store) |
protected |
DefaultDomainObjectCollection(java.lang.Class<? extends T> type,
java.util.Collection<T> store,
CollectionEventRegister<T> eventRegister) |
protected |
DefaultDomainObjectCollection(DefaultDomainObjectCollection<? super T> collection,
CollectionFilter<T> filter) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T toAdd) |
boolean |
addAll(java.util.Collection<? extends T> c) |
void |
all(Action<? super T> 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.
|
protected void |
assertMutable() |
void |
beforeChange(java.lang.Runnable action)
Adds an action which is executed before this collection is mutated.
|
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
protected <S extends T> |
createFilter(java.lang.Class<? extends S> type,
Spec<? super S> spec) |
protected <S extends T> |
createFilter(java.lang.Class<S> type) |
protected CollectionFilter<T> |
createFilter(Spec<? super T> filter) |
protected <S extends T> |
filtered(CollectionFilter<S> filter) |
protected <S extends T> |
filteredEvents(CollectionFilter<S> filter) |
protected <S extends T> |
filteredStore(CollectionFilter<S> filter) |
java.util.Collection<T> |
findAll(Closure cl)
Returns a collection which contains the objects in this collection which meet the given closure specification.
|
protected <S extends java.util.Collection<? super T>> |
findAll(Closure cl,
S matches) |
protected CollectionEventRegister<T> |
getEventRegister() |
protected java.util.Collection<T> |
getStore() |
java.lang.Class<? extends T> |
getType() |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
DomainObjectCollection<T> |
matching(Closure spec)
Returns a collection which contains the objects in this collection which meet the given closure specification.
|
DomainObjectCollection<T> |
matching(Spec<? super T> spec)
Returns a collection which contains the objects in this collection which meet the given specification.
|
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> target) |
int |
size() |
Action<? super T> |
whenObjectAdded(Action<? super T> 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<? super T> |
whenObjectRemoved(Action<? super T> 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.
|
<S extends T> |
withType(java.lang.Class<S> type)
Returns a collection containing the objects in this collection of the given type.
|
<S extends T> |
withType(java.lang.Class<S> type,
Action<? super S> configureAction)
Returns a collection containing the objects in this collection of the given type.
|
<S extends T> |
withType(java.lang.Class<S> type,
Closure configureClosure)
Returns a collection containing the objects in this collection of the given type.
|
public DefaultDomainObjectCollection(java.lang.Class<? extends T> type, java.util.Collection<T> store)
protected DefaultDomainObjectCollection(java.lang.Class<? extends T> type, java.util.Collection<T> store, CollectionEventRegister<T> eventRegister)
protected DefaultDomainObjectCollection(DefaultDomainObjectCollection<? super T> collection, CollectionFilter<T> filter)
public java.lang.Class<? extends T> getType()
protected java.util.Collection<T> getStore()
protected CollectionEventRegister<T> getEventRegister()
protected CollectionFilter<T> createFilter(Spec<? super T> filter)
protected <S extends T> CollectionFilter<S> createFilter(java.lang.Class<S> type)
protected <S extends T> CollectionFilter<S> createFilter(java.lang.Class<? extends S> type, Spec<? super S> spec)
protected <S extends T> DefaultDomainObjectCollection<S> filtered(CollectionFilter<S> filter)
protected <S extends T> java.util.Collection<S> filteredStore(CollectionFilter<S> filter)
protected <S extends T> CollectionEventRegister<S> filteredEvents(CollectionFilter<S> filter)
public DomainObjectCollection<T> matching(Spec<? super T> spec)
DomainObjectCollectionmatching in interface DomainObjectCollection<T>spec - The specification to use.public DomainObjectCollection<T> matching(Closure spec)
DomainObjectCollectionmatching in interface DomainObjectCollection<T>spec - The specification to use. The closure gets a collection element as an argument.public <S extends T> DomainObjectCollection<S> withType(java.lang.Class<S> type)
DomainObjectCollectionwithType in interface DomainObjectCollection<T>type - The type of objects to find.public java.util.Iterator<T> iterator()
public void all(Action<? super T> action)
DomainObjectCollectionall in interface DomainObjectCollection<T>action - The action to be executedpublic void all(Closure action)
DomainObjectCollectionall in interface DomainObjectCollection<T>action - The action to be executedpublic <S extends T> DomainObjectCollection<S> withType(java.lang.Class<S> type, Action<? super S> configureAction)
DomainObjectCollectionwithType(type).all(configureAction)withType in interface DomainObjectCollection<T>type - The type of objects to find.configureAction - The action to execute for each object in the resulting collection.public <S extends T> DomainObjectCollection<S> withType(java.lang.Class<S> type, Closure configureClosure)
DomainObjectCollectionwithType(type).all(configureClosure).withType in interface DomainObjectCollection<T>type - The type of objects to find.configureClosure - The closure to execute for each object in the resulting collection.public Action<? super T> whenObjectAdded(Action<? super T> action)
DomainObjectCollectionAction to be executed when an object is added to this collection.whenObjectAdded in interface DomainObjectCollection<T>action - The action to be executedpublic Action<? super T> whenObjectRemoved(Action<? super T> action)
DomainObjectCollectionAction to be executed when an object is removed from this collection.whenObjectRemoved in interface DomainObjectCollection<T>action - The action to be executedpublic void whenObjectAdded(Closure action)
DomainObjectCollectionwhenObjectAdded in interface DomainObjectCollection<T>action - The closure to be calledpublic void whenObjectRemoved(Closure action)
DomainObjectCollectionwhenObjectRemoved in interface DomainObjectCollection<T>action - The closure to be calledpublic void beforeChange(java.lang.Runnable action)
public boolean add(T toAdd)
public boolean addAll(java.util.Collection<? extends T> c)
public void clear()
public boolean contains(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public boolean isEmpty()
public boolean remove(java.lang.Object o)
public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> target)
public int size()
public java.util.Collection<T> findAll(Closure cl)
DomainObjectCollectionfindAll in interface DomainObjectCollection<T>cl - The specification to use. The closure gets a collection element as an argument.protected void assertMutable()
Copyright © 2013. All rights reserved