public class NameConverterWorker extends AbstractPatternWorker implements MatchPhraseConstants
NameConverter class.
An automatic name conversion reporting facility can be triggered from a
ruleset. This mode is disabled by default. It is enabled with the NameConverterWorker.Library.setReportMode(boolean) user function. As this worker
converts names, a formatted history entry for each conversion is recorded.
At the end of processing (i.e., in a post-rule ruleset), a text report is
generated with NameConverterWorker.Library.generateReport(java.lang.String). The
report is written to a file which the caller specifies.
| Modifier and Type | Class and Description |
|---|---|
class |
NameConverterWorker.Library
Class whose instance is actually registered with the pattern engine's
symbol resolver as the primary library of name conversion user
functions.
|
private static class |
NameConverterWorker.WorkArea
Context local work area.
|
| Modifier and Type | Field and Description |
|---|---|
private static ContextLocal<NameConverterWorker.WorkArea> |
context
Context local work area.
|
private static java.lang.String |
RPT_FMT
Format specifier for the column report output.
|
private static java.util.Map<java.lang.String,java.lang.Long> |
TYPE_MAP
Map of conversion type literals, exposed by their constant names
|
ALL, CUSTOM, PRESERVE, SQL_MODE_DEFAULT, SQL_MODE_MINIMAL, SQL_MODE_VERBATIM, STANDARD, TYPE_CLASS, TYPE_COLUMN, TYPE_CONSTANT, TYPE_DATABASE, TYPE_DENORMALIZED_PROPERTY, TYPE_INDEX, TYPE_METHOD, TYPE_PROPERTY, TYPE_SIMPLE, TYPE_TABLE, TYPE_VARIABLE| Constructor and Description |
|---|
NameConverterWorker()
Default constructor which defines the symbol libraries to be registered.
|
| Modifier and Type | Method and Description |
|---|---|
void |
leaveAst(Aast ast)
Upon leaving an AST, if we are in report mode, reset name conversion history to allow data collection
for the next (if any) AST to be processed.
|
private void |
recordHistory(NameConverter converter,
java.lang.String result,
java.lang.String detail)
Helper method which records information about a name conversion.
|
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)
Called whenever the pattern engine visits a new AST, this method
prepares the history report facility to receive entries for names
converted while processing the AST.
|
getCopy, getLibrary, getResolver, getSource, isConditionalRuleSets, isFlagActivated, isRuntimeQueryMode, registerTree, setLibraryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfinish, initializeprivate static final java.lang.String RPT_FMT
private static final java.util.Map<java.lang.String,java.lang.Long> TYPE_MAP
private static final ContextLocal<NameConverterWorker.WorkArea> context
public NameConverterWorker()
public java.lang.Object resolveConstant(java.lang.String constant)
Long values, so that the conversion types can be
referenced by their NameConverter constant names from within
within user expressions.resolveConstant in interface PatternWorkerresolveConstant in class AbstractPatternWorkerconstant - A string representing a conversion type constant to be
resolved.Long initialized to the corresponding constant
value (values in NameConverter class), or
null if constant was not recognized
as a placeholder for such a literal.public void visitAst(Aast ast)
visitAst in interface PatternWorkerast - AST about to be processed by the pattern engine.public void leaveAst(Aast ast)
leaveAst in interface PatternWorkerast - Copy AST just processed.private void recordHistory(NameConverter converter, java.lang.String result, java.lang.String detail)
converter - Object which performed the name conversion.result - The name resulting from the conversion.detail - Additional notes.