java.lang.Object
org.jooq.impl.CallbackVisitListener
- All Implemented Interfaces:
EventListener
,VisitListener
A
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 TypeMethodDescriptionfinal void
clauseEnd
(VisitContext context) Called after leaving aClause
.final void
clauseStart
(VisitContext context) Called before entering aClause
.final CallbackVisitListener
onClauseEnd
(Consumer<? super VisitContext> newOnClauseEnd) final CallbackVisitListener
onClauseStart
(Consumer<? super VisitContext> newOnClauseStart) final CallbackVisitListener
onVisitEnd
(Consumer<? super VisitContext> newOnVisitEnd) final CallbackVisitListener
onVisitStart
(Consumer<? super VisitContext> newOnVisitStart) final void
visitEnd
(VisitContext context) Called after visiting aQueryPart
.final 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
- Parameters:
context
- The context containing information about the traversal.- See Also:
-
clauseEnd
Description copied from interface:VisitListener
Called after leaving aClause
.- Specified by:
clauseEnd
in interfaceVisitListener
- Parameters:
context
- The context containing information about the traversal.- See Also:
-
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
- Parameters:
context
- The context containing information about the traversal.- See Also:
-
visitEnd
Description copied from interface:VisitListener
Called after visiting aQueryPart
.- Specified by:
visitEnd
in interfaceVisitListener
- Parameters:
context
- The context containing information about the traversal.- See Also:
-
onClauseStart
-
onClauseEnd
-
onVisitStart
-
onVisitEnd
-