Package scriptella.driver.text
Class TextScriptExecutor
java.lang.Object
scriptella.driver.text.TextScriptExecutor
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Writes a text content to the output and performs properties expansion.
Result:
This class is a simplified template engine similar to Velocity, but of course less powerful. Nevertheless this executor is generally faster than external template engines and does not require any additional libraries.
Example:
Script:
$rownum;$name;$surname;${email.trim().replaceAll('@','_at_')}
Parameters:
| rownum | name | surname | |
|---|---|---|---|
| 1 | John | G | john@nosuchhost.com |
1;John;G;john_at_nosuchhost.com
- Version:
- 1.0
- Author:
- Fyodor Kupolov
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTextScriptExecutor(Writer out, TextConnectionParameters textParams) Creates an executor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidexecute(Reader reader, ParametersCallback pc, AbstractConnection.StatementCounter counter) Parses a script from read, expands properties and produces the output.voidflush()
-
Constructor Details
-
TextScriptExecutor
Creates an executor.- Parameters:
out- writer for output.textParams- text connection parameters.
-
-
Method Details
-
execute
public void execute(Reader reader, ParametersCallback pc, AbstractConnection.StatementCounter counter) Parses a script from read, expands properties and produces the output.- Parameters:
reader- script content.pc- parameters for substitution.counter- statements counter.
-
flush
- Specified by:
flushin interfaceFlushable- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-