Interface PersistenceHookProvider
- All Known Implementing Classes:
DefaultPersistenceHookRegistry,SpringBeanPersistenceHookProvider
public interface PersistenceHookProvider
A provider of persistence hooks. Each provider implementation decides what the persistence hooks are and how
they can be resolved by the context. For example, some providers may look in the Spring application context, some
providers may use dynamic scripts for the hooks, some providers may use external microservices for the hooks, etc.
Implementations are recommended to use a very specific schema for the hook name, that is not used by any other provider, e.g.
"bean://", "script://", "http://", etc., so that the provider could be addressed specifically, if the
same hook exists in mulitple providers. Also, the implementations may choose to support a hook name without a schema at all. In
this case a provider placed first in the executor
(see DefaultPersistenceHookExecutor.setHookProviders(List))
will override hooks with the same name in the providers following it in the list.
-
Method Summary
Modifier and TypeMethodDescriptiongetPostPersistHook(@NotNull PersistenceContext context) Retrieves aPostPersistHookby the hook name.getPrePersistHook(@NotNull PersistenceContext context) Retrieves aPrePersistHookby the hook name.
-
Method Details
-
getPrePersistHook
Retrieves aPrePersistHookby the hook name.- Parameters:
context- context of the data being persisted.- Returns:
- a hook matching the persistence context or an
Optional.empty(), if there is no hook for the provided context.
-
getPostPersistHook
Retrieves aPostPersistHookby the hook name.- Parameters:
context- context of the data being persisted.- Returns:
- a hook matching the persistence context or an
Optional.empty(), if there is no hook for the provided context..
-