public class DefaultDomainObjectCollection<T> extends AbstractCollection<T> implements DomainObjectCollection<T>
| Modifier | Constructor and Description |
|---|---|
|
DefaultDomainObjectCollection(Class<? extends T> type,
Collection<T> store) |
protected |
DefaultDomainObjectCollection(Class<? extends T> type,
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(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(Runnable action)
Adds an action which is executed before this collection is mutated.
|
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
protected <S extends T> |
createFilter(Class<? extends S> type,
Spec<? super S> spec) |
protected <S extends T> |
createFilter(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) |
Collection<T> |
findAll(Closure cl)
Returns a collection which contains the objects in this collection which meet the given closure specification.
|
protected <S extends Collection<? super T>> |
findAll(Closure cl,
S matches) |
protected CollectionEventRegister<T> |
getEventRegister() |
protected Collection<T> |
getStore() |
Class<? extends T> |
getType() |
boolean |
isEmpty() |
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(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(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(Class<S> type)
Returns a collection containing the objects in this collection of the given type.
|
<S extends T> |
withType(Class<S> type,
Action<? super S> configureAction)
Returns a collection containing the objects in this collection of the given type.
|
<S extends T> |
withType(Class<S> type,
Closure configureClosure)
Returns a collection containing the objects in this collection of the given type.
|
toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequals, hashCode, toArray, toArraypublic DefaultDomainObjectCollection(Class<? extends T> type, Collection<T> store)
protected DefaultDomainObjectCollection(Class<? extends T> type, Collection<T> store, CollectionEventRegister<T> eventRegister)
protected DefaultDomainObjectCollection(DefaultDomainObjectCollection<? super T> collection, CollectionFilter<T> filter)
protected Collection<T> getStore()
protected CollectionEventRegister<T> getEventRegister()
protected CollectionFilter<T> createFilter(Spec<? super T> filter)
protected <S extends T> CollectionFilter<S> createFilter(Class<S> type)
protected <S extends T> CollectionFilter<S> createFilter(Class<? extends S> type, Spec<? super S> spec)
protected <S extends T> DefaultDomainObjectCollection<S> filtered(CollectionFilter<S> filter)
protected <S extends T> 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(Class<S> type)
DomainObjectCollectionwithType in interface DomainObjectCollection<T>type - The type of objects to find.public Iterator<T> iterator()
iterator in interface Iterable<T>iterator in interface Collection<T>iterator in class AbstractCollection<T>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(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(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(Runnable action)
public boolean add(T toAdd)
add in interface Collection<T>add in class AbstractCollection<T>public boolean addAll(Collection<? extends T> c)
addAll in interface Collection<T>addAll in class AbstractCollection<T>public void clear()
clear in interface Collection<T>clear in class AbstractCollection<T>public boolean contains(Object o)
contains in interface Collection<T>contains in class AbstractCollection<T>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<T>containsAll in class AbstractCollection<T>public boolean isEmpty()
isEmpty in interface Collection<T>isEmpty in class AbstractCollection<T>public boolean remove(Object o)
remove in interface Collection<T>remove in class AbstractCollection<T>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<T>removeAll in class AbstractCollection<T>public boolean retainAll(Collection<?> target)
retainAll in interface Collection<T>retainAll in class AbstractCollection<T>public int size()
size in interface Collection<T>size in class AbstractCollection<T>public 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 <S extends Collection<? super T>> S findAll(Closure cl, S matches)
protected void assertMutable()
Copyright © 2013. All rights reserved