public class MetaDataCommandTargetResolver extends Object implements CommandTargetResolver
| Constructor and Description |
|---|
MetaDataCommandTargetResolver(String identifierKey)
Initializes the MetaDataCommandTargetResolver to use the given
identifierKey as the MetaData
key to the aggregate identifier, and a null (ignored) version. |
MetaDataCommandTargetResolver(String identifierKey,
String versionKey)
Initializes the MetaDataCommandTargetResolver to use the given
identifierKey as the MetaData
key to the aggregate identifier, and the given versionKey as key to the (optional) version entry. |
| 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 MetaDataCommandTargetResolver(String identifierKey)
identifierKey as the MetaData
key to the aggregate identifier, and a null (ignored) version.
When the given identifierKey is not present in a command's MetaData, resolveTarget(CommandMessage) will raise an IllegalArgumentExceptionidentifierKey - The key of the meta data field containing the aggregate identifierpublic MetaDataCommandTargetResolver(String identifierKey, String versionKey)
identifierKey as the MetaData
key to the aggregate identifier, and the given versionKey as key to the (optional) version entry.
When the given identifierKey is not present in a command's MetaData, resolveTarget(CommandMessage) will raise an IllegalArgumentExceptionidentifierKey - The key of the meta data field containing the aggregate identifierversionKey - The key of the meta data field containing the expected aggregate version. A
null value may be provided to ignore the versionpublic VersionedAggregateIdentifier resolveTarget(CommandMessage<?> command)
CommandTargetResolvercommand should be executed. The version may be null if no specific version is required.resolveTarget in interface CommandTargetResolvercommand - The command from which to extract the identifier and versionVersionedAggregateIdentifier instance reflecting the aggregate to execute the command onCopyright © 2010–2018. All rights reserved.