# Class GeneratorTask<T>

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.plugins.ide.api.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, Named, ExtensionAware, Task, Configurable<Task>`

Direct Known Subclasses:
  `GenerateSolutionFileTask, PropertiesGeneratorTask, PropertyListGeneratorTask, XmlGeneratorTask`

@DisableCachingByDefault(because="Abstract super-class, not to be instantiated directly") public abstract 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.

Since:
  1.0

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface Named

  `Named.Namer`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final org.gradle.internal.MutableActionSet<T>`
  `afterConfigured`
  The after configured.
  `protected final org.gradle.internal.MutableActionSet<T>`
  `beforeConfigured`
  The before configured.
  `protected T`
  `domainObject`
  The domain object.
  `protected org.gradle.plugins.ide.internal.generator.generator.Generator<T>`
  `generator`
  The generator.

  ### Fields inherited from interface Task

  `TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GeneratorTask()`
  Creates a new `GeneratorTask`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `generate()`
  Generate.
  `protected boolean`
  `getIncremental()`
  Whether this generator task can be treated as an incremental task or not
  `File`
  `getInputFile()`
  The input file to load the initial configuration from.
  `protected @Nullable File`
  `getInputFileIfExists()`
  Returns the input file if exists.
  `protected abstract org.gradle.internal.reflect.Instantiator`
  `getInstantiator()`
  `File`
  `getOutputFile()`
  The output file to write the final configuration to.
  `void`
  `setInputFile(@Nullable 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.

  ### Methods inherited from class org.gradle.api.internal.ConventionTask

  `conventionMapping, conventionMapping, getConventionMapping`

  ### Methods inherited from class DefaultTask

  `compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService`

  ### Methods inherited from class org.gradle.api.internal.AbstractTask

  `acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getLoggingManager, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, service, setImpliesSubProjects`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface Task

  `doNotTrackState, notCompatibleWithConfigurationCache, service`

- ## Field Details

  - ### beforeConfigured

    protected final org.gradle.internal.MutableActionSet<T> beforeConfigured
    The before configured.
    Since:
      1.0

  - ### afterConfigured

    protected final org.gradle.internal.MutableActionSet<T> afterConfigured
    The after configured.
    Since:
      1.0

  - ### generator

    protected org.gradle.plugins.ide.internal.generator.generator.Generator<T> generator
    The generator.
    Since:
      1.0

  - ### domainObject

    protected T domainObject
    The domain object.
    Since:
      1.0

- ## Constructor Details

  - ### GeneratorTask

    public GeneratorTask()
    Creates a new `GeneratorTask`.
    Since:
      1.0

- ## Method Details

  - ### getIncremental

    @Internal protected boolean getIncremental()
    Whether this generator task can be treated as an incremental task or not
    Since:
      4.7

  - ### generate

    protected void generate()
    Generate.
    Since:
      9.6.0

  - ### getInstantiator

    @Inject protected abstract org.gradle.internal.reflect.Instantiator getInstantiator()

  - ### getInputFile

    @Internal("Covered by inputFileIfExists") 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.
    Since:
      1.0

  - ### getInputFileIfExists

    @Optional @PathSensitive(NONE) @InputFile protected @Nullable File getInputFileIfExists()
    Returns the input file if exists.
    Since:
      3.0

  - ### setInputFile

    public void setInputFile(@Nullable File inputFile)
    Sets the input file to load the initial configuration from.
    Parameters:
      `inputFile` - The input file. Use null to use the output file.
    Since:
      1.0

  - ### getOutputFile

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

  - ### setOutputFile

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