Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.gradle.api.tasks
Class GeneratorTask<T>

    java.lang.Object
      org.gradle.api.internal.AbstractTask
          org.gradle.api.DefaultTask
              org.gradle.api.internal.ConventionTask
                  org.gradle.api.tasks.GeneratorTask<T>

Type Parameters:
  `T` - The domain object for the configuration file.

All Implemented Interfaces:
  Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, Task, org.gradle.util.Configurable<Task>

Direct Known Subclasses:
  XmlGeneratorTask

    public class GeneratorTask<T>

extends org.gradle.api.internal.ConventionTask

A `GeneratorTask` generates a configuration file based on a domain object of type T. When executed, the task:

- loads the object from the input file, if it exists.
- Calls the beforeConfigured actions, passing the object to each action.
- Configures the object in some task-specific way.
- Calls the afterConfigured actions, passing the object to each action.
- writes the object to the output file.

Field Summary
`protected org.gradle.api.internal.tasks.generator.Generator<T>` | `generator`

Fields inherited from interface org.gradle.api.Task
`TASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_NAME, TASK_OVERWRITE, TASK_TYPE`

Constructor Summary
`GeneratorTask()`

Method Summary
`void` | `beforeConfigured(Action<? super T> action)` Adds an action to be called before the domain object is configured by this task.
`void` | `beforeConfigured(Closure closure)` Adds a closure to be called before the domain object is configured by this task.
`File` | `getInputFile()` The input file to load the initial configuration from.
`File` | `getOutputFile()` The output file to write the final configuration to.
`void` | `setInputFile(File inputFile)` Sets the input file to load the initial configuration from.
`void` | `setOutputFile(File outputFile)` Sets the output file to write the final configuration to.
`void` | `whenConfigured(Action<? super T> action)` Adds an action to be called after the domain object has been configured by this task.
`void` | `whenConfigured(Closure closure)` Adds a closure to be called after the domain object has been configured by this task.

Methods inherited from class org.gradle.api.internal.ConventionTask
`conventionMapping, getConventionMapping, setConventionMapping`

Methods inherited from class org.gradle.api.internal.AbstractTask
`captureStandardOutput, compareTo, configure, deleteAllActions, dependsOn, dependsOnTaskDidWork, disableStandardOutputCapture, doFirst, doFirst, doLast, doLast, equals, execute, getActions, getAdditionalProperties, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDidWork, getDynamicObjectHelper, getEnabled, getExecuter, getGroup, getInputs, getLogger, getLogging, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getStandardOutputCapture, getState, getTaskDependencies, getTemporaryDir, hashCode, hasProperty, injectIntoNewInstance, isEnabled, leftShift, onlyIf, onlyIf, property, setActions, setConvention, setDependsOn, setDescription, setDidWork, setEnabled, setExecuter, setGroup, setName, setOnlyIf, setOnlyIf, setProject, setProperty, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### generator

    protected org.gradle.api.internal.tasks.generator.Generator<T> generator

Constructor Detail

### GeneratorTask

    public GeneratorTask()

Method Detail

### getInputFile

    public File getInputFile()

  The input file to load the initial configuration from. Defaults to the output file. If the specified input file does not exist, this task uses some default initial configuration.

  Returns:
    The input file.

### setInputFile

    public void setInputFile(File inputFile)

  Sets the input file to load the initial configuration from.

  Parameters:
    `inputFile` - The input file. Use null to use the output file.

### getOutputFile

    public File getOutputFile()

  The output file to write the final configuration to.

  Returns:
    The output file.

### setOutputFile

    public void setOutputFile(File outputFile)

  Sets the output file to write the final configuration to.

  Parameters:
    `outputFile` - The output file.

### beforeConfigured

    public void beforeConfigured(Closure closure)

  Adds a closure to be called before the domain object is configured by this task. The domain object is passed as a parameter to the closure.

  The closure is executed after the domain object has been loaded from the input file. Using this method allows you to change the domain object in some way before the task configures it.

  Parameters:
    `closure` - The closure to execute.

### beforeConfigured

    public void beforeConfigured(Action<? super T> action)

  Adds an action to be called before the domain object is configured by this task. The domain object is passed as a parameter to the action.

  The action is executed after the domain object has been loaded from the input file. Using this method allows you to change the domain object in some way before the task configures it.

  Parameters:
    `action` - The action to execute.

### whenConfigured

    public void whenConfigured(Closure closure)

  Adds a closure to be called after the domain object has been configured by this task. The domain object is passed as a parameter to the closure.

  The closure is executed just before the domain object is written to the output file. Using this method allows you to override the configuration applied by this task.

  Parameters:
    `closure` - The closure to execute.

### whenConfigured

    public void whenConfigured(Action<? super T> action)

  Adds an action to be called after the domain object has been configured by this task. The domain object is passed as a parameter to the action.

  The action is executed just before the domain object is written to the output file. Using this method allows you to override the configuration applied by this task.

  Parameters:
    `action` - The action to execute.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD