public class TemplateExecutor extends Object
this class does the following:
- a template file (=input) is processed by the TemplateSplitter (see doc of .).
the resulting outputfile is put into a temporary directory (.\tempgen).
- the javac compiler is invoked to compile the generated file. The resulting class is loaded, executed
and produces the final result (a file).
| Modifier and Type | Field and Description |
|---|---|
boolean |
sysout |
| Constructor and Description |
|---|
TemplateExecutor()
creates a new, unitialized TemplateExecutor
|
TemplateExecutor(File templateFile,
File outputFile,
Object context)
creates a new TemplateExecutor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
execute() |
boolean |
execute(PrintStream output)
execute the template and produce the outputfiles.
Note: if there are errors like "bad classformat" or "invalid magic number", clear all files in the .\tempgen directory |
File |
getOutputFile() |
File |
getTemplateFile() |
String |
getTmpDir() |
static void |
main(String[] arg) |
static int |
Run(String templateFile,
Object context) |
static int |
Run(String outputFile,
String templateFile,
Object context) |
void |
setFiles(File templateFile,
File outputFile,
Object context)
sets the files to be processed by the TemplateExecutor
|
void |
setTemplateFile(File templateFile) |
void |
setTmpDir(String tmpDir)
set the directory to put temporary files
|
public TemplateExecutor()
public void setTemplateFile(File templateFile)
public File getTemplateFile()
public void setFiles(File templateFile, File outputFile, Object context)
templateFile - - the templatefile to processoutputFile - - the file to write tocontext - - an Object which is forwarded to the templatepublic void setTmpDir(String tmpDir)
public String getTmpDir()
public boolean execute(PrintStream output) throws Exception
output - - output is written here if != null, else a file is created in the output directoryExceptionpublic File getOutputFile()
public static void main(String[] arg)
Copyright © 2014. All rights reserved.