Module org.jooq
Package org.jooq

Interface VisitListener

All Superinterfaces:
All Known Implementing Classes:
CallbackVisitListener, DefaultVisitListener

public interface VisitListener extends EventListener
A listener for QueryPart traversal events.

Users may want to centrally inject custom behaviour when rendering their QueryPart objects or when binding values to PreparedStatement s. 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:


The above example will create the following set of events:

 | +-Clause.FIELD
 |   +-val(1)
     | +-table("A")

Whatever is not a Clause in the above example is a QueryPart.

A remark about performance

Implementors 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: java/.

Lukas Eder