Class AnnotatedEntityMetamodel<E>

java.lang.Object
org.axonframework.modelling.entity.annotation.AnnotatedEntityMetamodel<E>
Type Parameters:
E - The type of entity this metamodel describes.
All Implemented Interfaces:
DescribableComponent, EntityMetamodel<E>, EntityEvolver<E>

@Internal public class AnnotatedEntityMetamodel<E> extends Object implements EntityMetamodel<E>, DescribableComponent
An EntityMetamodel implementation that uses reflection to inspect the entity. It will detect annotated command- and event-handling methods, as well as child entities annotated with EntityMember. Everything that is discovered is then registered to a delegate EntityMetamodel, so that essentially a declared metamodel is built of which it's structure is clearly defined.

Besides normal EntityMetamodel operations, this metamodel also provides a means to get the expected representation of a command or event handler based on the QualifiedName of the message type. This is useful for determining the payload type of a command or event handler when multiple handlers are present for the same message type.

NOTE: This class is a complete rewrite of the pre-5.0.0 org.axonframework.modelling.command.inspection.AnnotatedAggregateMetaModelFactory. Both scan the class for annotated methods and fields, but the AnnotatedEntityModel dropped aggregate versioning (conflict resolution), no longer required an id in the entity, and creates a declarative metamodel instead of relying on reflection at runtime.

This class is marked Internal because it is an annotation-scanning implementation detail: it is built by the framework from the entity class and exposes reflection-specific behavior (such as getExpectedRepresentation(QualifiedName)) that is not part of the EntityMetamodel contract. Users should interact with entities through the EntityMetamodel interface, which can be freely decorated or replaced, rather than depending on this concrete type.

Since:
3.1.0
Author:
Mitchell Herrijgers, Allard Buijze