- All Superinterfaces:
EventListener
- All Known Implementing Classes:
CallbackRecordListener
,DefaultRecordListener
UpdatableRecord
s.
Users may want to centrally inject custom behaviour when manipulating their
UpdatableRecord
objects, performing CRUD. This service provider
allows to hook in callback method implementations for before or after any of
these methods:
UpdatableRecord.store()
UpdatableRecord.insert()
UpdatableRecord.update()
UpdatableRecord.delete()
UpdatableRecord.refresh()
A RecordListener
does not act as a client-side trigger. As such,
it does not affect any bulk DML statements (e.g. a
DSLContext.update(Table)
), whose affected records are not available
to clients. For those purposes, use a server-side trigger
DSLContext.createTrigger(Name)
if records should be changed, or a
VisitListener
if the SQL query should be changed, independently of
data.
- Author:
- Lukas Eder
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
deleteEnd
(RecordContext ctx) Called after deleting anUpdatableRecord
.default void
deleteStart
(RecordContext ctx) Called before deleting anUpdatableRecord
.default void
exception
(RecordContext ctx) Called when an exception occurs.default void
insertEnd
(RecordContext ctx) Called after inserting anUpdatableRecord
.default void
insertStart
(RecordContext ctx) Called before inserting anUpdatableRecord
.default void
loadEnd
(RecordContext ctx) Called after loading anUpdatableRecord
.default void
loadStart
(RecordContext ctx) Called before loading anUpdatableRecord
.default void
mergeEnd
(RecordContext ctx) Called after merging anUpdatableRecord
.default void
mergeStart
(RecordContext ctx) Called before merging anUpdatableRecord
.static CallbackRecordListener
onDeleteEnd
(Consumer<? super RecordContext> onDeleteEnd) Create aRecordListener
with aonDeleteEnd(Consumer)
implementation.static CallbackRecordListener
onDeleteStart
(Consumer<? super RecordContext> onDeleteStart) Create aRecordListener
with aonDeleteStart(Consumer)
implementation.static CallbackRecordListener
onException
(Consumer<? super RecordContext> onException) Create aRecordListener
with aonException(Consumer)
implementation.static CallbackRecordListener
onInsertEnd
(Consumer<? super RecordContext> onInsertEnd) Create aRecordListener
with aonInsertEnd(Consumer)
implementation.static CallbackRecordListener
onInsertStart
(Consumer<? super RecordContext> onInsertStart) Create aRecordListener
with aonInsertStart(Consumer)
implementation.static CallbackRecordListener
onLoadEnd
(Consumer<? super RecordContext> onLoadEnd) Create aRecordListener
with aonLoadEnd(Consumer)
implementation.static CallbackRecordListener
onLoadStart
(Consumer<? super RecordContext> onLoadStart) Create aRecordListener
with aonLoadStart(Consumer)
implementation.static CallbackRecordListener
onMergeEnd
(Consumer<? super RecordContext> onMergeEnd) Create aRecordListener
with aonMergeEnd(Consumer)
implementation.static CallbackRecordListener
onMergeStart
(Consumer<? super RecordContext> onMergeStart) Create aRecordListener
with aonMergeStart(Consumer)
implementation.static CallbackRecordListener
onRefreshEnd
(Consumer<? super RecordContext> onRefreshEnd) Create aRecordListener
with aonRefreshEnd(Consumer)
implementation.static CallbackRecordListener
onRefreshStart
(Consumer<? super RecordContext> onRefreshStart) Create aRecordListener
with aonRefreshStart(Consumer)
implementation.static CallbackRecordListener
onStoreEnd
(Consumer<? super RecordContext> onStoreEnd) Create aRecordListener
with aonStoreEnd(Consumer)
implementation.static CallbackRecordListener
onStoreStart
(Consumer<? super RecordContext> onStoreStart) Create aRecordListener
with aonStoreStart(Consumer)
implementation.static CallbackRecordListener
onUpdateEnd
(Consumer<? super RecordContext> onUpdateEnd) Create aRecordListener
with aonUpdateEnd(Consumer)
implementation.static CallbackRecordListener
onUpdateStart
(Consumer<? super RecordContext> onUpdateStart) Create aRecordListener
with aonUpdateStart(Consumer)
implementation.default void
refreshEnd
(RecordContext ctx) Called after refreshing anUpdatableRecord
.default void
Called before refreshing anUpdatableRecord
.default void
storeEnd
(RecordContext ctx) Called after storing anUpdatableRecord
.default void
storeStart
(RecordContext ctx) Called before storing anUpdatableRecord
.default void
updateEnd
(RecordContext ctx) Called after updating anUpdatableRecord
.default void
updateStart
(RecordContext ctx) Called before updating anUpdatableRecord
.
-
Method Details
-
storeStart
Called before storing anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
prior to storing. Note that modifying the record's primary key value may influence whether storing results in anINSERT
orUPDATE
statement.A store event will generate a nested
insertStart(RecordContext)
orupdateStart(RecordContext)
event.- Parameters:
ctx
- The context containing information about the record operation.- See Also:
-
storeEnd
Called after storing anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
after storing. Note that modifying the record's primary key value may influence whether storing results in anINSERT
orUPDATE
statement.A store event will generate a nested
insertEnd(RecordContext)
orupdateEnd(RecordContext)
event.- Parameters:
ctx
- The context containing information about the record operation.- See Also:
-
insertStart
Called before inserting anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
prior to inserting.- Parameters:
ctx
- The context containing information about the record operation.- See Also:
-
insertEnd
Called after inserting anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
after inserting.- Parameters:
ctx
- The context containing information about the record operation.- See Also:
-
updateStart
Called before updating anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
prior to updating.- Parameters:
ctx
- The context containing information about the record operation.- See Also:
-
updateEnd
Called after updating anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
after updating.- Parameters:
ctx
- The context containing information about the record operation.- See Also:
-
mergeStart
Called before merging anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
prior to merging.- Parameters:
ctx
- The context containing information about the record operation.- See Also:
-
mergeEnd
Called after merging anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
after merging.- Parameters:
ctx
- The context containing information about the record operation.- See Also:
-
deleteStart
Called before deleting anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
prior to deleting.- Parameters:
ctx
- The context containing information about the record operation.- See Also:
-
deleteEnd
Called after deleting anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
after deleting.- Parameters:
ctx
- The context containing information about the record operation.- See Also:
-
loadStart
Called before loading anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
prior to loading.- Parameters:
ctx
- The context containing information about the record operation.
-
loadEnd
Called after loading anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
after loading.- Parameters:
ctx
- The context containing information about the record operation.
-
refreshStart
Called before refreshing anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
prior to refreshing.- Parameters:
ctx
- The context containing information about the record operation.- See Also:
-
refreshEnd
Called after refreshing anUpdatableRecord
.Implementations are allowed to modify
RecordContext.record()
after refreshing.- Parameters:
ctx
- The context containing information about the record operation.- See Also:
-
exception
Called when an exception occurs.- Parameters:
ctx
- The context containing information about the record operation.
-
onStoreStart
Create aRecordListener
with aonStoreStart(Consumer)
implementation. -
onStoreEnd
Create aRecordListener
with aonStoreEnd(Consumer)
implementation. -
onInsertStart
Create aRecordListener
with aonInsertStart(Consumer)
implementation. -
onInsertEnd
Create aRecordListener
with aonInsertEnd(Consumer)
implementation. -
onUpdateStart
Create aRecordListener
with aonUpdateStart(Consumer)
implementation. -
onUpdateEnd
Create aRecordListener
with aonUpdateEnd(Consumer)
implementation. -
onMergeStart
Create aRecordListener
with aonMergeStart(Consumer)
implementation. -
onMergeEnd
Create aRecordListener
with aonMergeEnd(Consumer)
implementation. -
onDeleteStart
Create aRecordListener
with aonDeleteStart(Consumer)
implementation. -
onDeleteEnd
Create aRecordListener
with aonDeleteEnd(Consumer)
implementation. -
onLoadStart
Create aRecordListener
with aonLoadStart(Consumer)
implementation. -
onLoadEnd
Create aRecordListener
with aonLoadEnd(Consumer)
implementation. -
onRefreshStart
Create aRecordListener
with aonRefreshStart(Consumer)
implementation. -
onRefreshEnd
Create aRecordListener
with aonRefreshEnd(Consumer)
implementation. -
onException
Create aRecordListener
with aonException(Consumer)
implementation.
-