- All Implemented Interfaces:
EventListener
,VisitListener
VisitListener
that allows for functional composition.
For example:
VisitListener listener = VisitListener
.onVisitStart(ctx -> something())
.onVisitEnd(ctx -> something());
- Author:
- Lukas Eder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clauseEnd(VisitContext context)
Called after leaving aClause
.void
clauseStart(VisitContext context)
Called before entering aClause
.onClauseEnd(Consumer<? super VisitContext> newOnClauseEnd)
onClauseStart(Consumer<? super VisitContext> newOnClauseStart)
onVisitEnd(Consumer<? super VisitContext> newOnVisitEnd)
onVisitStart(Consumer<? super VisitContext> newOnVisitStart)
void
visitEnd(VisitContext context)
Called after visiting aQueryPart
.void
visitStart(VisitContext context)
Called before visiting aQueryPart
.
-
Constructor Details
-
CallbackVisitListener
public CallbackVisitListener()
-
-
Method Details
-
clauseStart
Description copied from interface:VisitListener
Called before entering aClause
.- Specified by:
clauseStart
in interfaceVisitListener
- See Also:
Context.start(Clause)
-
clauseEnd
Description copied from interface:VisitListener
Called after leaving aClause
.- Specified by:
clauseEnd
in interfaceVisitListener
- See Also:
Context.end(Clause)
-
visitStart
Description copied from interface:VisitListener
Called before visiting aQueryPart
.Certain
VisitListener
implementations may chose to replace theQueryPart
contained in the argumentVisitContext
throughVisitContext.queryPart(QueryPart)
. This can be used for many use-cases, for example to add aCHECK OPTION
to an OracleINSERT
statement:
The above SQL transformation allows to prevent inserting new books for authors other than those with-- Original query INSERT INTO book (id, author_id, title) VALUES (10, 15, '1984') -- Transformed query INSERT INTO ( SELECT * FROM book WHERE author_id IN (1, 2, 3) WITH CHECK OPTION ) (id, author_id, title) VALUES (10, 15, '1984')
author_id IN (1, 2, 3)
- Specified by:
visitStart
in interfaceVisitListener
- See Also:
Context.visit(QueryPart)
-
visitEnd
Description copied from interface:VisitListener
Called after visiting aQueryPart
.- Specified by:
visitEnd
in interfaceVisitListener
- See Also:
Context.visit(QueryPart)
-
onClauseStart
-
onClauseEnd
-
onVisitStart
-
onVisitEnd
-