Class SqlConversionContext
- All Implemented Interfaces:
de.calamanari.adl.cnv.ConversionContext
SqlConversionContext is a container holding the information for a particular level of the expression to be converted while visiting the
CoreExpression's DAG.
Important: Each SqlConversionContext instance has a local (level) state and a global state (process state of the converter). The
clear()-command does not affect the instance returned by getProcessContext().
The global state gets assigned by the converter (precisely the SqlConversionProcessContext injects itself upon creation of the level context
object. This ensures that the global process is common for all level context objects created during the same conversion run.
The concept allows parts of the conversion logic not only to access configuration data and the isolated data of a level and the parent level but also to exchange information. This is for example required when we automatically map arguments to columns with derived filter conditions.
- Author:
- Karl Eilebrecht
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Resets this context to its defaultsde.calamanari.adl.CombinedExpressionTypeList<de.calamanari.adl.irl.CoreExpression> booleanbooleanbooleanisSkipped(de.calamanari.adl.irl.CoreExpression expression) voidMarks this level to be a negated matchvoidsetCombiType(de.calamanari.adl.CombinedExpressionType combiType) voidsetProcessContext(SqlConversionProcessContext processContext) Method to be called initially by the converter to ensure all level contexts created during a conversion share the same global process context.voidskipChildExpression(de.calamanari.adl.irl.CoreExpression expression) Sets the given expression on the skip-list to prevent duplicate processing, if a child has been processed implicitly by the parentvoidSets a flag that we don't need a closing brace because a formerly combined expression (OR/AND)
has turned into a simple IN or NOT IN SQL condition.
-
Constructor Details
-
SqlConversionContext
public SqlConversionContext()
-
-
Method Details
-
skipChildExpression
public void skipChildExpression(de.calamanari.adl.irl.CoreExpression expression) Sets the given expression on the skip-list to prevent duplicate processing, if a child has been processed implicitly by the parent- Parameters:
expression- to be marked as skipped
-
isSkipped
public boolean isSkipped(de.calamanari.adl.irl.CoreExpression expression) - Parameters:
expression-- Returns:
- true if the given element has been skipped and should not be processed again
-
isNegation
public boolean isNegation()- Returns:
- true if we are currently processing a negated match
-
markNegation
public void markNegation()Marks this level to be a negated match -
getCombiType
public de.calamanari.adl.CombinedExpressionType getCombiType()- Returns:
- combination type of this level, AND by default
-
setCombiType
public void setCombiType(de.calamanari.adl.CombinedExpressionType combiType) - Parameters:
combiType- combination type to be set for the current level
-
clear
public void clear()Resets this context to its defaults- Specified by:
clearin interfacede.calamanari.adl.cnv.ConversionContext
-
setProcessContext
Method to be called initially by the converter to ensure all level contexts created during a conversion share the same global process context.- Parameters:
processContext- the converters global state
-
suppressClosingBrace
public void suppressClosingBrace()Sets a flag that we don't need a closing brace because a formerly combined expression (OR/AND)
has turned into a simple IN or NOT IN SQL condition. -
isClosingBraceSuppressed
public boolean isClosingBraceSuppressed()- Returns:
- true if an OR/AND should omit the closing brace
-
getSkippedChildExpressions
- Returns:
- list with skipped child expressions
-
getProcessContext
- Returns:
- the global part of the context (related to the conversion process independent from the levels)
-