public class TextScriptExecutor
extends java.lang.Object
implements java.io.Closeable, java.io.Flushable
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
PropertiesSubstitutor
Constructor and Description |
---|
TextScriptExecutor(java.io.Writer out,
TextConnectionParameters textParams)
Creates an executor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
execute(java.io.Reader reader,
ParametersCallback pc,
AbstractConnection.StatementCounter counter)
Parses a script from read, expands properties and produces the output.
|
void |
flush() |
public TextScriptExecutor(java.io.Writer out, TextConnectionParameters textParams)
out
- writer for output.textParams
- text connection parameters.public void execute(java.io.Reader reader, ParametersCallback pc, AbstractConnection.StatementCounter counter)
reader
- script content.pc
- parameters for substitution.counter
- statements counter.public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
Copyright © Copyright 2006-2019 The Scriptella Project Team.