Groovy Documentation

org.gradle.api.tasks
[Java] Class GeneratorTask

java.lang.Object
  org.gradle.api.internal.ConventionTask
      org.gradle.api.tasks.GeneratorTask

public class GeneratorTask
extends ConventionTask

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

Parameters:
- The domain object for the configuration file.


Field Summary
protected Generator generator

 
Constructor Summary
GeneratorTask()

 
Method Summary
void beforeConfigured(groovy.lang.Closure closure)

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

void beforeConfigured(Action action)

Adds an action to be called before the domain object is configured by this task.

java.io.File getInputFile()

The input file to load the initial configuration from.

java.io.File getOutputFile()

The output file to write the final configuration to.

void setInputFile(java.io.File inputFile)

Sets the input file to load the initial configuration from.

void setOutputFile(java.io.File outputFile)

Sets the output file to write the final configuration to.

void whenConfigured(groovy.lang.Closure closure)

Adds a closure to be called after the domain object has been configured by this task.

void whenConfigured(Action action)

Adds an action to be called after the domain object has been configured by this task.

 

Field Detail

generator

protected Generator generator


 
Constructor Detail

GeneratorTask

public GeneratorTask()


 
Method Detail

beforeConfigured

public void beforeConfigured(groovy.lang.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 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.


getInputFile

public java.io.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 a default initial configuration.
Returns:
The input file.


getOutputFile

@OutputFile
public java.io.File getOutputFile()
The output file to write the final configuration to.
Returns:
The output file.


setInputFile

public void setInputFile(java.io.File inputFile)
Sets the input file to load the initial configuration from.
Parameters:
inputFile - The input file. Use null to use the output file.


setOutputFile

public void setOutputFile(java.io.File outputFile)
Sets the output file to write the final configuration to.
Parameters:
outputFile - The output file.


whenConfigured

public void whenConfigured(groovy.lang.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 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.


 

Groovy Documentation