T
- The type of tasks which this collection contains.Collection<T>
, DomainObjectCollection<T>
, Iterable<T>
, NamedDomainObjectCollection<T>
, NamedDomainObjectSet<T>
, Set<T>
TaskContainer
public interface TaskCollection<T extends Task> extends NamedDomainObjectSet<T>
TaskCollection
contains a set of Task
instances, and provides a number of query methods.Modifier and Type | Method | Description |
---|---|---|
T |
getAt(String name) |
Locates an object by name, failing if there is no such task.
|
T |
getByName(String name) |
Locates an object by name, failing if there is no such object.
|
T |
getByName(String name,
Closure configureClosure) |
Locates an object by name, failing if there is no such object.
|
TaskCollection<T> |
matching(Closure closure) |
Returns a collection which contains the objects in this collection which meet the given closure specification.
|
TaskCollection<T> |
matching(Spec<? super T> spec) |
Returns a collection which contains the objects in this collection which meet the given specification.
|
TaskProvider<T> |
named(String name) |
Locates a task by name, without triggering its creation or configuration, failing if there is no such object.
|
<S extends T> |
named(String name,
Class<S> type) |
Locates a object by name and type, without triggering its creation or configuration, failing if there is no such object.
|
<S extends T> |
named(String name,
Class<S> type,
Action<? super S> configurationAction) |
Locates a object by name and type, without triggering its creation or configuration, failing if there is no such object.
|
TaskProvider<T> |
named(String name,
Action<? super T> configurationAction) |
Locates a object by name, without triggering its creation or configuration, failing if there is no such object.
|
void |
whenTaskAdded(Closure closure) |
Adds a closure to be called when a task is added to this collection.
|
Action<? super T> |
whenTaskAdded(Action<? super T> action) |
Adds an
Action to be executed when a task is added to this collection. |
<S extends T> |
withType(Class<S> type) |
Returns a collection containing the objects in this collection of the given type.
|
parallelStream, removeIf, stream, toArray
addAllLater, addLater, all, all, configureEach, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType
add, addAll, addRule, addRule, addRule, findByName, getAsMap, getByName, getCollectionSchema, getNamer, getNames, getRules
findAll
TaskCollection<T> matching(Spec<? super T> spec)
matching
in interface DomainObjectCollection<T extends Task>
matching
in interface NamedDomainObjectCollection<T extends Task>
matching
in interface NamedDomainObjectSet<T extends Task>
spec
- The specification to use.TaskCollection<T> matching(Closure closure)
matching
in interface DomainObjectCollection<T extends Task>
matching
in interface NamedDomainObjectCollection<T extends Task>
matching
in interface NamedDomainObjectSet<T extends Task>
closure
- The specification to use. The closure gets a collection element as an argument.T getByName(String name, Closure configureClosure) throws UnknownTaskException
getByName
in interface NamedDomainObjectCollection<T extends Task>
name
- The object nameconfigureClosure
- The closure to use to configure the object.UnknownTaskException
T getByName(String name) throws UnknownTaskException
getByName
in interface NamedDomainObjectCollection<T extends Task>
name
- The object nameUnknownTaskException
<S extends T> TaskCollection<S> withType(Class<S> type)
withType
in interface DomainObjectCollection<T extends Task>
withType
in interface NamedDomainObjectCollection<T extends Task>
withType
in interface NamedDomainObjectSet<T extends Task>
type
- The type of objects to find.Action<? super T> whenTaskAdded(Action<? super T> action)
Action
to be executed when a task is added to this collection.
Like DomainObjectCollection.all(Action)
, this method will cause all tasks in this container to be realized.
action
- The action to be executedvoid whenTaskAdded(Closure closure)
closure
- The closure to be calledwhenTaskAdded(Action)
T getAt(String name) throws UnknownTaskException
NamedDomainObjectCollection.getByName(String)
. You can call this method in your build script by using the groovy []
operator.getAt
in interface NamedDomainObjectCollection<T extends Task>
name
- The object nameUnknownTaskException
TaskProvider<T> named(String name) throws UnknownTaskException
named
in interface NamedDomainObjectCollection<T extends Task>
name
- The task nameProvider
that will return the task when queried. The task may be created and configured at this point, if not already.UnknownTaskException
- If a task with the given name is not defined.TaskProvider<T> named(String name, Action<? super T> configurationAction) throws UnknownTaskException
named
in interface NamedDomainObjectCollection<T extends Task>
name
- The object's nameProvider
that will return the object when queried. The object may be created and configured at this point, if not already.UnknownTaskException
<S extends T> TaskProvider<S> named(String name, Class<S> type) throws UnknownTaskException
named
in interface NamedDomainObjectCollection<T extends Task>
name
- The object's nametype
- The object's typeProvider
that will return the object when queried. The object may be created and configured at this point, if not already.UnknownTaskException
<S extends T> TaskProvider<S> named(String name, Class<S> type, Action<? super S> configurationAction) throws UnknownTaskException
named
in interface NamedDomainObjectCollection<T extends Task>
name
- The object's nametype
- The object's typeconfigurationAction
- The action to use to configure the object.Provider
that will return the object when queried. The object may be created and configured at this point, if not already.UnknownTaskException