public interface Transformer
Transformer executes transformations by applying templates to source files and writing
the result to output files.| Modifier and Type | Method and Description |
|---|---|
boolean |
configure(java.io.File pConfigurationFile)
Configure this transformer with the values in a configuration file.
|
int |
executeTransformations(java.util.function.BiFunction<java.io.File,java.io.File,OutputFileSpec> pOutputFileMapping)
Apply all successfully loaded template files to all successfully loaded source files.
|
int |
loadSources(org.gradle.api.file.FileCollection pSourceFiles)
Load the source files to transform in the next call to
executeTransformations(BiFunction). |
int |
loadTemplates(org.gradle.api.file.FileCollection pTemplateFiles)
Load the template files to transform source files with in the next call to
executeTransformations(BiFunction). |
default void |
logTransformation(java.io.File pSourceFile,
java.io.File pTemplateFile,
OutputFileSpec pOutputFile)
Log that a template file is applied to a source file to produce an output file.
|
void |
setOutputFileCharset(java.nio.charset.Charset pCharset)
Set the character set to encode the output files with.
|
void |
setTransformationParameters(java.util.Map<java.lang.String,java.lang.Object> pParameters)
Set the parameters to be used in all transformations.
|
boolean configure(java.io.File pConfigurationFile)
pConfigurationFile - The configuration file. If this parameter is null, a default
configuration will be used.void setTransformationParameters(java.util.Map<java.lang.String,java.lang.Object> pParameters)
pParameters - The transformation parameters.java.lang.NullPointerException - if pParameters is null.void setOutputFileCharset(java.nio.charset.Charset pCharset)
Note that all implementations may not honor this setting.
pCharset - The output file character set.int loadSources(org.gradle.api.file.FileCollection pSourceFiles)
executeTransformations(BiFunction).pSourceFiles - The source files to load.int loadTemplates(org.gradle.api.file.FileCollection pTemplateFiles)
executeTransformations(BiFunction).pTemplateFiles - The template files to load.int executeTransformations(java.util.function.BiFunction<java.io.File,java.io.File,OutputFileSpec> pOutputFileMapping)
pOutputFileMapping - A function that returns the output file for a source/template
file combination.java.lang.NullPointerException - if pOutputFileMapping is null.default void logTransformation(java.io.File pSourceFile,
java.io.File pTemplateFile,
OutputFileSpec pOutputFile)
pSourceFile - The source file.pTemplateFile - The template file.pOutputFile - The output file, or null if no explicit output file is used in the
transformation.java.lang.NullPointerException - if pSourceFile or pTemplateFile is null.