- All Superinterfaces:
Function<GeneratorContext<R,
,X, T>, Field<T>> Serializable
- All Known Implementing Classes:
AuditGenerator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface Generator<R extends Record,X extends Table<R>,T>
extends Function<GeneratorContext<R,X,T>,Field<T>>, Serializable
A generator can be used with
DataType.generatedAlwaysAs(Generator)
to
implement dynamic, client side computed columns, i.e. computed columns with
QOM.GenerationLocation.CLIENT
.
There are two types of client side computed columns:
QOM.GenerationOption.STORED
: The computation is performed when writing to a record viaInsert
,Update
, orMerge
QOM.GenerationOption.VIRTUAL
: The computation is performed when reading a record viaSelect
, or theRETURNING
clause ofInsert
,Update
,Delete
.
Depending on the type of client side computed column, the exact time when the
computation is performed may differ, practically. It is not specified, when
it happens, but users may assume that it happens only once per query
rendering and Field
expression which references a Generator
,
independently of how many times the resulting expression is repeated in the
resulting SQL query.
This API is part of a commercial only feature. To use this feature, please use the jOOQ Professional Edition or the jOOQ Enterprise Edition.
- Author:
- Lukas Eder
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
supports
(GeneratorStatementType statementType) Whether this generator supports a given statement type.
-
Method Details
-
supports
Whether this generator supports a given statement type.Implementations may choose to deactivate themselves for some statement types, e.g. if they want to be invoked only for
GeneratorStatementType.INSERT
.- Parameters:
statementType
- The statement type.
-