Package org.gradle.language.twirl

# Interface TwirlSourceSet

All Superinterfaces:
  `Buildable`, `BuildableComponentSpec`, `ComponentSpec`, `LanguageSourceSet`, `ModelElement`, `Named`

@Incubating public interface TwirlSourceSet extends LanguageSourceSet
Represents a source set containing twirl templates

         apply plugin: 'play'

         model {
           components {
             play {
               sources {
                 withType(TwirlSourceSet) {
                   // Use template format views.formats.csv.CsvFormat for all files named *.scala.csv
                   // Additionally, include views.formats.csv._ package imports in generated sources.
                   addUserTemplateFormat("csv", "views.formats.csv.CsvFormat", "views.formats.csv._")
                   // Add these additional imports to all generated Scala code from Twirl templates
                   additionalImports = [ 'my.pkg._', 'my.pkg.MyClass' ]
                 }
               }
             }
           }
         }

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.gradle.api.Named

`Named.Namer`

## Method Summary

Modifier and Type
Method
Description
`void`
`addUserTemplateFormat(String extension, String templateType, String... imports)`
Adds a custom template format.
`List<String>`
`getAdditionalImports()`
Returns the list of additional imports to add to the generated Scala code.
`TwirlImports`
`getDefaultImports()`
The default imports that should be added to generated source files
`List<TwirlTemplateFormat>`
`getUserTemplateFormats()`
Returns the custom template formats configured for this source set.
`void`
`setAdditionalImports(List<String> additionalImports)`
Sets the additional imports to add to all generated Scala code.
`void`
`setDefaultImports(TwirlImports defaultImports)`
Sets the default imports that should be added to generated source files to the given language
`void`
`setUserTemplateFormats(List<TwirlTemplateFormat> userTemplateFormats)`
Sets the custom template formats for this source set.

### Methods inherited from interface org.gradle.api.Buildable

`getBuildDependencies`

### Methods inherited from interface org.gradle.api.BuildableComponentSpec

`builtBy, getBuildTask, hasBuildDependencies, setBuildTask`

### Methods inherited from interface org.gradle.platform.base.ComponentSpec

`getProjectPath`

### Methods inherited from interface org.gradle.language.base.LanguageSourceSet

`generatedBy, getParentName, getSource`

### Methods inherited from interface org.gradle.model.ModelElement

`getDisplayName, getName`

## Method Details

### getDefaultImports

TwirlImports getDefaultImports()
The default imports that should be added to generated source files

### setDefaultImports

void setDefaultImports(TwirlImports defaultImports)
Sets the default imports that should be added to generated source files to the given language

### getUserTemplateFormats

List<TwirlTemplateFormat> getUserTemplateFormats()
Returns the custom template formats configured for this source set.

Since:
  4.2

### setUserTemplateFormats

void setUserTemplateFormats(List<TwirlTemplateFormat> userTemplateFormats)
Sets the custom template formats for this source set.

Since:
  4.2

### addUserTemplateFormat

void addUserTemplateFormat(String extension, String templateType, String... imports)
Adds a custom template format.

Parameters:
  `extension` - file extension this template applies to (e.g., `html`).
  `templateType` - fully-qualified type for this template format.
  `imports` - additional imports to add for the custom template format.
Since:
  4.2

### getAdditionalImports

List<String> getAdditionalImports()
Returns the list of additional imports to add to the generated Scala code.

Since:
  4.2

### setAdditionalImports

void setAdditionalImports(List<String> additionalImports)
Sets the additional imports to add to all generated Scala code.

Parameters:
  `additionalImports` - additional imports
Since:
  4.2