Package org.axonframework.modelling
Class PropertyBasedEntityIdResolver
java.lang.Object
org.axonframework.modelling.PropertyBasedEntityIdResolver
- All Implemented Interfaces:
EntityIdResolver<Object>
Implementation of a
EntityIdResolver that inspects the payload of a Message for an identifier.
The identifier is resolved by looking for a field or method with the given property name. Methods will
automatically be resolved by looking for a method with the name get<Property> or <Property>.
This field or method needs to have or return a non-null value. If a null value is found, a
EntityIdResolutionException is thrown. If no member is found at all, a
TargetEntityIdMemberMismatchException is thrown.
- Since:
- 5.0.0
- Author:
- Mitchell Herrijgers
-
Constructor Summary
ConstructorsConstructorDescriptionPropertyBasedEntityIdResolver(String property) Initialize the resolver with the givenpropertyname. -
Method Summary
Modifier and TypeMethodDescriptionresolve(Message message, ProcessingContext context) Resolve the id of the entity from the givenmessageandcontext.
-
Constructor Details
-
PropertyBasedEntityIdResolver
Initialize the resolver with the givenpropertyname.- Parameters:
property- The name of the property to resolve the identifier from.
-
-
Method Details
-
resolve
@Nonnull public Object resolve(@Nonnull Message message, @Nonnull ProcessingContext context) throws EntityIdResolutionException Description copied from interface:EntityIdResolverResolve the id of the entity from the givenmessageandcontext.- Specified by:
resolvein interfaceEntityIdResolver<Object>- Parameters:
message- The message to resolve the id from.context- The context in which the message is processed.- Returns:
- The id of the entity.
- Throws:
EntityIdResolutionException- When the id could not be resolved.
-