Class AnnotationCommandTargetResolver

java.lang.Object
org.axonframework.modelling.command.AnnotationCommandTargetResolver
All Implemented Interfaces:
CommandTargetResolver

public class AnnotationCommandTargetResolver extends Object implements CommandTargetResolver
CommandTargetResolver that uses annotations on the command to identify the methods that provide the Aggregate Identifier of the targeted Aggregate and optionally the expected version of the aggregate.

This implementation expects at least one method (without parameters) or field in the command to be annotated with TargetAggregateIdentifier. If on a method, the result of the invocation of that method will use as Aggregate Identifier. If on a field, the value held in that field is used.

Similarly, the expected aggregate version may be provided by annotating a method (without parameters) or field with TargetAggregateVersion. The return value of the method or value held in the field is used as the expected version. Note that the method must return a Long value, or a value that may be parsed as a Long.

Since:
1.2
Author:
Allard Buijze