- 
- All Superinterfaces:
- EventListener
 - All Known Implementing Classes:
- DefaultVisitListener
 
 public interface VisitListener extends EventListener A listener forQueryParttraversal events.Users may want to centrally inject custom behaviour when rendering their QueryPartobjects or when binding values toPreparedStatements. This service provider allows to hook in callback method implementations before or after these events:The following rules apply to visiting clauses and query parts: - Clauses may "surround" a query part. See an example below.
- Not every query part is "surrounded" by a clause
 An example is given here: SELECT 1 FROM [A CROSS JOIN B] The above example will create the following set of events: Clause.SELECT+-Clause.SELECT_SELECT| +-Clause.FIELD| +-val(1) +-Clause.SELECT_FROM+-Clause.TABLE_JOIN+-Clause.TABLE| +-table("A") +-Clause.TABLE_JOIN_CROSS+-Clause.TABLE+-table("B")Whatever is not a Clausein the above example is aQueryPart.A remark about performanceImplementors of this SPI should be wary of performance implications of their implementations. The below methods are called for every AST element of every query, which produces a lot of calls throughout an application. What would otherwise be premature optimisations may have great effect inside the VisitListener. For more details, please refer to this article: http://blog.jooq.org/2015/02/05/top-10-easy-performance-optimisations-in- java/.- Author:
- Lukas Eder
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclauseEnd(VisitContext context)Called after leaving aClause.voidclauseStart(VisitContext context)Called before entering aClause.voidvisitEnd(VisitContext context)Called after visiting aQueryPart.voidvisitStart(VisitContext context)Called before visiting aQueryPart.
 
- 
- 
- 
Method Detail- 
clauseStartvoid clauseStart(VisitContext context) Called before entering aClause.- See Also:
- Context.start(Clause)
 
 - 
clauseEndvoid clauseEnd(VisitContext context) Called after leaving aClause.- See Also:
- Context.end(Clause)
 
 - 
visitStartvoid visitStart(VisitContext context) Called before visiting aQueryPart.Certain VisitListenerimplementations may chose to replace theQueryPartcontained in the argumentVisitContextthroughVisitContext.queryPart(QueryPart). This can be used for many use-cases, for example to add aCHECK OPTIONto an OracleINSERTstatement:-- 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)- See Also:
- Context.visit(QueryPart)
 
 - 
visitEndvoid visitEnd(VisitContext context) Called after visiting aQueryPart.- See Also:
- Context.visit(QueryPart)
 
 
- 
 
-