public class AnnotationCommandTargetResolver extends Object implements CommandTargetResolver
TargetAggregateIdentifier
. If on a method, the result of the invocation of that method will used 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.Constructor and Description |
---|
AnnotationCommandTargetResolver() |
Modifier and Type | Method and Description |
---|---|
VersionedAggregateIdentifier |
resolveTarget(CommandMessage<?> command)
Returns the Aggregate Identifier and optionally the expected version of the aggregate on which the given
command should be executed. |
public VersionedAggregateIdentifier resolveTarget(CommandMessage<?> command)
CommandTargetResolver
command
should be executed. The version may be null
if no specific version is required.resolveTarget
in interface CommandTargetResolver
command
- The command from which to extract the identifier and versionVersionedAggregateIdentifier
instance reflecting the aggregate to execute the command onCopyright © 2010–2017. All rights reserved.