public interface PatternWorker
Modifier and Type | Method and Description |
---|---|
void |
finish()
This method is called once (and only once) per invocation of the
pattern engine's
PatternEngine.run() method, after all rulesets
are processed, and after the pattern engine's own global post-rules
are processed. |
java.lang.Object |
getLibrary()
This method should return a worker library to be registered with the
expression engine's symbol resolver, if the implementation wishes to
expose bean-like properties or user functions to user expressions.
|
void |
initialize()
This method is called once (and only once) per invocation of the
pattern engine's
PatternEngine.run() method, immediately after
the worker object is constructed. |
java.lang.Object |
resolveConstant(java.lang.String constant)
This method is called each time the pattern engine needs to resolve
a string constant into a numeric, boolean, or string literal value.
|
void |
visitAst(Aast ast)
This method is called each time a new AST is visited, just before the
pattern engine processes that AST.
|
void initialize()
PatternEngine.run()
method, immediately after
the worker object is constructed. This hook is provided to give the
worker implementation an opportunity to register symbol resolution
libraries with the pattern engine's symbol resolver, as well as to
perform any internal initialization.void finish()
PatternEngine.run()
method, after all rulesets
are processed, and after the pattern engine's own global post-rules
are processed. This hook is provided to allow the worker implementation
to perform any necessary resource cleanup or other post-processing. It
is safe to assume that no rule will be executed after this method
completes.java.lang.Object getLibrary()
It is invoked by a RuleContainer
when it registers the
pattern worker implementation.
null
if the pattern
worker implementation does not need to register a library.java.lang.Object resolveConstant(java.lang.String constant)
It must return an object of the following type (or null
):
constant
- A string representing a constant to be resolved.null
if constant
was not recognized as a placeholder
for a literal.void visitAst(Aast ast)
ast
- The root node of the source AST about to be processed by the
pattern engine.