public class DefaultTaskContainer extends DefaultTaskCollection<Task> implements TaskContainerInternal
project| Constructor and Description |
|---|
DefaultTaskContainer(ProjectInternal project,
Instantiator instantiator,
ITaskFactory taskFactory) |
| Modifier and Type | Method and Description |
|---|---|
Task |
add(Map<String,?> options)
Creates a
Task and adds it to this container. |
Task |
add(Map<String,?> options,
Closure configureClosure)
Creates a
Task adds it to this container. |
Task |
add(String name)
Creates a
Task with the given name and adds it to this container. |
<T extends Task> |
add(String name,
Class<T> type)
Creates a
Task with the given name and type, and adds it to this container. |
Task |
add(String name,
Closure configureClosure)
Creates a
Task with the given name adds it to this container. |
TaskContainerInternal |
configure(Closure configureClosure)
Allows the container to be configured, creating missing objects as they are referenced.
|
Task |
create(String name)
Creates a new item with the given name, adding it to this container.
|
Task |
create(String name,
Closure configureClosure)
Creates a new item with the given name, adding it to this container, then configuring it with the given closure.
|
protected Object |
createConfigureDelegate(Closure configureClosure) |
Task |
findByPath(String path)
Locates a task by path.
|
Task |
getByPath(String path)
Locates a task by path.
|
DynamicObject |
getTasksAsDynamicObject() |
Task |
replace(String name)
Creates a
Task with the given name and adds it to this container, replacing any existing task with the
same name. |
<T extends Task> |
replace(String name,
Class<T> type)
Creates a
Task with the given name and type, and adds it to this container, replacing any existing
task of the same name. |
Task |
resolveTask(Object path) |
createNotFoundException, filtered, getTypeDisplayName, matching, matching, whenTaskAdded, whenTaskAdded, withTypefilteredStore, findAll, getDisplayNameadd, addRule, addRule, assertCanAdd, assertCanAdd, findByName, findByNameWithoutRules, getAsDynamicObject, getAsMap, getAt, getByName, getByName, getConvention, getElementsAsDynamicObject, getExtensions, getInstantiator, getNamer, getRules, handleAttemptToAddItemWithNonUniqueName, hasWithName, removeByNameaddAll, all, all, assertMutable, beforeChange, clear, contains, containsAll, createFilter, createFilter, createFilter, filteredEvents, findAll, getEventRegister, getStore, getType, isEmpty, iterator, remove, removeAll, retainAll, size, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withTypetoArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAt, getByName, getByName, matching, matching, whenTaskAdded, whenTaskAdded, withTypefindAlladd, addAll, addRule, addRule, findByName, getAsMap, getNamer, getRulesall, all, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withTypepublic DefaultTaskContainer(ProjectInternal project, Instantiator instantiator, ITaskFactory taskFactory)
public Task add(Map<String,?> options)
TaskContainerCreates a Task and adds it to this container. A map of creation options can be passed to this method
to control how the task is created. The following options are available:
| Option | Description | Default Value |
|---|---|---|
"name" | The name of the task to create. | None. Must be specified. |
"type" | The class of the task to create. | DefaultTask |
"action" | The closure or TaskAction to
execute when the task executes. See Task.doFirst(Action). | null |
"overwrite" | Replace an existing task? | false |
"dependsOn" | The dependencies of the task. See here for more details. | [] |
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
If a task with the given name already exists in this container and the override option is not set
to true, an exception is thrown.
add in interface TaskContaineroptions - The task creation options.public Task add(Map<String,?> options, Closure configureClosure) throws InvalidUserDataException
TaskContainerCreates a Task adds it to this container. A map of creation options can be passed to this method to
control how the task is created. See TaskContainer.add(java.util.Map) for the list of options available. The given
closure is used to configure the task before it is returned by this method.
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
add in interface TaskContaineroptions - The task creation options.configureClosure - The closure to use to configure the task.InvalidUserDataException - If a task with the given name already exsists in this project.public <T extends Task> T add(String name, Class<T> type)
TaskContainerCreates a Task with the given name and type, and adds it to this container.
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
add in interface TaskContainername - The name of the task to be created.type - The type of task to create.public Task create(String name)
NamedDomainObjectContainercreate in interface NamedDomainObjectContainer<Task>name - The name to assign to the created objectpublic Task add(String name)
TaskContainerCreates a Task with the given name and adds it to this container.
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
add in interface TaskContainername - The name of the task to be createdpublic Task replace(String name)
TaskContainerCreates a Task with the given name and adds it to this container, replacing any existing task with the
same name.
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
replace in interface TaskContainername - The name of the task to be createdpublic Task create(String name, Closure configureClosure)
NamedDomainObjectContainercreate in interface NamedDomainObjectContainer<Task>name - The name to assign to the created objectconfigureClosure - The closure to configure the created object withpublic Task add(String name, Closure configureClosure)
TaskContainerCreates a Task with the given name adds it to this container. The given closure is used to configure
the task before it is returned by this method.
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
add in interface TaskContainername - The name of the task to be createdconfigureClosure - The closure to use to configure the task.public <T extends Task> T replace(String name, Class<T> type)
TaskContainerCreates a Task with the given name and type, and adds it to this container, replacing any existing
task of the same name.
After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file. See here for more details.
replace in interface TaskContainername - The name of the task to be created.type - The type of task to create.public Task findByPath(String path)
TaskContainerLocates a task by path. You can supply a task name, a relative path, or an absolute path. Relative paths are interpreted relative to the project for this container. This method returns null if no task with the given path exists.
findByPath in interface TaskContainerpath - the path of the task to be returnedpublic Task resolveTask(Object path)
resolveTask in interface TaskResolverpublic Task getByPath(String path) throws UnknownTaskException
TaskContainerLocates a task by path. You can supply a task name, a relative path, or an absolute path. Relative paths are interpreted relative to the project for this container. This method throws an exception if no task with the given path exists.
getByPath in interface TaskContainerpath - the path of the task to be returnedUnknownTaskException - If no task with the given path exists.public TaskContainerInternal configure(Closure configureClosure)
NamedDomainObjectContainerAllows the container to be configured, creating missing objects as they are referenced.
TODO: example usage
configure in interface NamedDomainObjectContainer<Task>configure in interface Configurable<NamedDomainObjectContainer<Task>>configureClosure - The closure to configure this container withpublic DynamicObject getTasksAsDynamicObject()
getTasksAsDynamicObject in interface TaskContainerInternalCopyright © 2013. All rights reserved