EntityCallback types that apply to the annotated entity.
Storm creates each declared callback through its public no-argument constructor, once per entity type, and applies it to the annotated entity only, whatever its own type parameter would otherwise match. Declared callbacks fire before the callbacks registered on the template, in the order they are declared here.
@EntityCallbacks(PostAuditCallback.class)
public record Post(@PK Integer id, String title, Instant createdAt) implements Entity<Integer> {}
This is the place for a callback that is part of the entity's own definition and needs nothing but the entity:
audit fields, normalization, a check. A callback that needs collaborators cannot be created this way; register that
one on the template instead, as a bean in Spring Boot, through the Ktor plugin's entityCallback(...), or
with ORMTemplate.withEntityCallback. Registering an instance of a declared type replaces
the declared one, so a callback that is both declared here and registered fires once, as the registered
instance.
A declared callback applies wherever the entity is written, including templates an application creates for migrations, imports or tests. A callback that has to apply to some of an application's templates and not others belongs on those templates rather than on the entity.
- Since:
- 1.15
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionClass<? extends EntityCallback<?>>[]The callback types that apply to the annotated entity.
-
Element Details
-
value
Class<? extends EntityCallback<?>>[] valueThe callback types that apply to the annotated entity.- Returns:
- the callback types; each must have a public no-argument constructor and a type parameter that matches the annotated entity.
-