Package com.groiss.store
Interface PersistentEventHandler<P extends Persistent>
- All Known Implementing Classes:
ObjectExtensionCleaner
,PersistentEventAdapter
public interface PersistentEventHandler<P extends Persistent>
This interface provides a hook for some action when an object is inserted, updated or
deleted.
The methods beforeInsert, beforeUpdate, and beforeDelete are
called before the database operation is executed but after the corresponding
method of Persistent has been called.
The methods afterInsert, afterUpdate, afterDelete and afterRead are
called after both the database operation and the corresponding
method of Persistent have been executed.
Register your event handler using
StoreUtil.addEventHandler(PersistentEventHandler, Class[])
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
afterDelete
(P o) Called after the object has been deleted from the database.default void
afterInsert
(P o) Called after the object has been inserted into the database.default void
Called after the object is read from database.default void
afterUpdate
(P o) Called after the object has been updated in the database.default void
beforeDelete
(P o) Called before the object is deleted from the database.default void
beforeInsert
(P o) Called before the object is inserted into the database.default void
beforeUpdate
(P o) Called before the object is updated in the database.
-
Method Details
-
beforeInsert
Called before the object is inserted into the database.- Parameters:
o
- the object to be inserted
-
beforeUpdate
Called before the object is updated in the database.- Parameters:
o
- the object to be updated
-
beforeDelete
Called before the object is deleted from the database.- Parameters:
o
- the object to be deleted
-
afterInsert
Called after the object has been inserted into the database.- Parameters:
o
- the inserted object
-
afterUpdate
Called after the object has been updated in the database.- Parameters:
o
- the updated object
-
afterDelete
Called after the object has been deleted from the database.- Parameters:
o
- the deleted object
-
afterRead
Called after the object is read from database.- Parameters:
o
- the object, which has been read
-