|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface PostParseProcessor
PostParseProcessor can be invoked by the
SQLParserManager as part of the semantical resolving and
validation phase after the syntactical phase, the actual parse itself.
After the successful parse the SQLParserManager will
bottom-up process the created a SQLQueryObject model
instance and for each contained SQLQueryObject will check for a
given PostParseProcessor, to be invoked by
process(SQLQueryObject), if the SQLQueryObject is a
subtype of one of the PostParseProcessor's candidate types
(getProcessCandidateTypes()).
Stateful PostParseProcessors can collect information that are
valid within the context of one QueryStatement.
If a PostParseProcessor is stateful, its state can be reset
after each processed QueryStatement by implementing
resetState() which will be called after the
QueryStatement processing is completed.
A PostParseProcessor can also do modifications on the
SQLObject stack of the parser, for example to invalidate
SQLObjects for further post parse processing or replacing a
SQLObject that was generated by the parser with a
SQLObject generated in exchange by the
PostParseProcessor. The SQLObject replacement
mapping will be retrieved with getParsedObjectsReplacementMap()
before the resetState() is called.| Method Summary | |
|---|---|
void |
config(PostParseProcessorConfiguration config)
Configures this PostParseProcessor with the arguments
provided in the given PostParseProcessorConfiguration. |
java.util.Map |
getParsedObjectsReplacementMap()
Returns a Map containing parsed SQLQueryObjects mapped to
either the SQLQueryObject that replaces it, or is mapped to
null, if that parsed object simply is to be removed. |
java.lang.Class[] |
getProcessCandidateTypes()
The candidate types for this PostParseProcessor. |
java.util.List |
process(SQLQueryObject sqlQuery)
The call back method invoked for each of the SQLQueryObjects in the SQLQueryObject model
instance returned by the parser, if the SQLQueryObject
complies with one of the types in the Class[] returned by
this getProcessCandidateTypes() |
void |
resetState()
If this PostParseProcessor is stateful within the context of
one QueryStatement, this method should reset the state, as
it might be used for post parse processing of more than one
QueryStatement. |
| Method Detail |
|---|
java.lang.Class[] getProcessCandidateTypes()
PostParseProcessor.
SQLQueryObject types that this
process(SQLQueryObject) method gets
invoked forvoid config(PostParseProcessorConfiguration config)
PostParseProcessor with the arguments
provided in the given PostParseProcessorConfiguration.
config - the configuration arguments that can be consumed by this
PostParseProcessor
java.util.List process(SQLQueryObject sqlQuery)
throws SQLParserException
SQLQueryObjects in the SQLQueryObject model
instance returned by the parser, if the SQLQueryObject
complies with one of the types in the Class[] returned by
this getProcessCandidateTypes()
sqlQuery - instance of one of the types in the Class[]
returned by getProcessCandidateTypes()
SQLParseErrorInfo
objects, with information about the error encountered,
must not be null
SQLParserException - if the error encountered is severe enough to
discard the instance of the SQLQueryObject model
returned by the parservoid resetState()
PostParseProcessor is stateful within the context of
one QueryStatement, this method should reset the state, as
it might be used for post parse processing of more than one
QueryStatement.
This method is invoked after the SQLParserManager
bottom-up processed the SQLQueryObject elements of a
QueryStatement up to the top/root-element - the
QueryStatement object itself.
java.util.Map getParsedObjectsReplacementMap()
SQLQueryObjects mapped to
either the SQLQueryObject that replaces it, or is mapped to
null, if that parsed object simply is to be removed.
This method will be invoked after this PostParseProcessor
is done processing one QueryStatement before the
resetState() method is called.
This method should return a mapping, if during the post parse processing
SQLQueryObjects are found that are determined to have been
created by the parser mistakenly, because the parser did not have the
knowledge about context or semantics. This then
PostParseProcessor might create a substitution for it or
simply delete it by mapping the original SQLQueryObject to
null.
By providing this mapping, invalid SQLQueryObjects can be
removed from the parser's parsed-element-list and therefore will not be
subject to further post parse processing of other
PostParseProcessors.
SQLQueryObject originally created by parserSQLQueryObject created by this
PostParseProcessor to substitute the originally
created by the parser
SQLQueryObjects mapped to
either the SQLQueryObject that replaces it to
null, if that parsed object simply is to be removed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||