Interface EntityCommandHandlerInterceptor<E>

Type Parameters:
E - The type of the entity modeled by this interface.

public interface EntityCommandHandlerInterceptor<E>
Interceptor for CommandMessages dispatched to an entity through its EntityMetamodel.

Unlike the generic MessageHandlerInterceptor, this interceptor is aware of the entity instance the command targets, allowing it to base its decision (proceed, short-circuit, or otherwise transform the outcome) on the entity's current state. This is comparable to an EntityCommandHandler, which for the same reason also receives the entity instance directly.

Interceptors are registered on an EntityMetamodelBuilder through EntityMetamodelBuilder.commandHandlerInterceptor(EntityCommandHandlerInterceptor). Registration order defines invocation order: the first registered interceptor is the outermost, invoked before any interceptor registered after it, before this entity's own command handlers, and before any command is forwarded to a child entity. When this entity is itself a child of another entity, interceptors registered on the parent entity are invoked before this entity's own interceptors.

The CommandHandlerInterceptor annotation is the annotation-based counterpart of this interface. Methods annotated as such on an entity class are detected and registered through the declarative configuration API.

Since:
5.3.2
Author:
Steven van Beelen
See Also: