Interface TwirlSourceSet
- All Superinterfaces:
Buildable, BuildableComponentSpec, ComponentSpec, LanguageSourceSet, ModelElement, Named
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 Named
Named.Namer -
Method Summary
Modifier and TypeMethodDescriptionvoidaddUserTemplateFormat(String extension, String templateType, String... imports) Adds a custom template format.Returns the list of additional imports to add to the generated Scala code.The default imports that should be added to generated source filesReturns the custom template formats configured for this source set.voidsetAdditionalImports(List<String> additionalImports) Sets the additional imports to add to all generated Scala code.voidsetDefaultImports(TwirlImports defaultImports) Sets the default imports that should be added to generated source files to the given languagevoidsetUserTemplateFormats(List<TwirlTemplateFormat> userTemplateFormats) Sets the custom template formats for this source set.Methods inherited from interface Buildable
getBuildDependenciesMethods inherited from interface BuildableComponentSpec
builtBy, getBuildTask, hasBuildDependencies, setBuildTaskMethods inherited from interface ComponentSpec
getProjectPathMethods inherited from interface LanguageSourceSet
generatedBy, getParentName, getSourceMethods inherited from interface ModelElement
getDisplayName, getName
-
Method Details
-
getDefaultImports
TwirlImports getDefaultImports()The default imports that should be added to generated source files -
setDefaultImports
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
Sets the custom template formats for this source set.- Since:
- 4.2
-
addUserTemplateFormat
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
-
setAdditionalImports
-