public final class FileGeneratorStringTemplate extends java.lang.Object implements FileGenerator
FileGeneratorStringTemplate
class generates source code files
on the basis of StringTemplates descriptions.Constructor and Description |
---|
FileGeneratorStringTemplate(java.lang.String outputFile,
java.lang.String[] templateGroupFiles,
StringTemplateBuilder templateBuilder)
Constructs a code generator parameterized with a hierarchy template groups, with a builder
that will initialize the code template and with the full name to the target output file.
|
Modifier and Type | Method and Description |
---|---|
void |
generate()
Generates the target file.
|
static void |
generateFile(java.lang.String fileName,
java.lang.String[] templateGroups,
StringTemplateBuilder templateBuilder)
Generates a file by the specified template.
|
public FileGeneratorStringTemplate(java.lang.String outputFile, java.lang.String[] templateGroupFiles, StringTemplateBuilder templateBuilder)
outputFile
- The full name of the target output file.templateGroupFiles
- List of template group files. Important: the order is from the root
of the hierarchy to child groups.templateBuilder
- Builder that is responsible for initialization of the template.public static void generateFile(java.lang.String fileName, java.lang.String[] templateGroups, StringTemplateBuilder templateBuilder)
fileName
- Full name of the generated file.templateGroups
- List of template group files.templateBuilder
- Builder responsible for initialization of the template.java.lang.IllegalArgumentException
- if any of the arguments is null
.java.lang.RuntimeException
- if an I/O error occurred during file generation.public void generate() throws java.io.IOException
generate
in interface FileGenerator
java.io.IOException
- It is raised if the methods fails to create the target file.