public interface TwirlSourceSet
The following example demonstrate the use of the source set in a build script using the Groovy DSL:
sourceSets { main { twirl { userTemplateFormats.add(newUserTemplateFormat('csv', 'views.formats.csv.CsvFormat', 'views.formats.csv._')) additionalImports = ['my.pkg._', 'my.pkg.MyClass'] } } }
Modifier and Type | Method and Description |
---|---|
ListProperty<String> |
getAdditionalImports()
Returns the list of additional imports to add to the generated Scala code.
|
ListProperty<String> |
getConstructorAnnotations()
Gets the list of construtor annotations to support dependency injection
|
Property<TwirlImports> |
getDefaultImports()
The default imports that should be added to generated source files.
|
SourceDirectorySet |
getTwirl()
Returns the source directory set.
|
ListProperty<TwirlTemplateFormat> |
getUserTemplateFormats()
Returns the custom template formats configured for this source set.
|
TwirlTemplateFormat |
newUserTemplateFormat(String extension,
String templateType,
String... imports)
Creates a new custom template format.
|
TwirlSourceSet |
twirl(Action<? super SourceDirectorySet> configureAction)
Configures the source set.
|
SourceDirectorySet getTwirl()
TwirlSourceSet twirl(Action<? super SourceDirectorySet> configureAction)
configureAction
- The configuration actionProperty<TwirlImports> getDefaultImports()
ListProperty<TwirlTemplateFormat> getUserTemplateFormats()
TwirlTemplateFormat newUserTemplateFormat(String extension, String templateType, String... imports)
extension
- The file extension this template applies to (e.g., html)templateType
- Fully-qualified type for this template formatimports
- Additional imports to add for the custom template formatListProperty<String> getAdditionalImports()
ListProperty<String> getConstructorAnnotations()