|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.commandhandling.MetaDataCommandTargetResolver
public class MetaDataCommandTargetResolver
CommandTargetResolver implementation that uses MetaData entries to extract the identifier and optionally the version of the aggregate that the command targets.
While this may require duplication of data (as the identifier is already included in the payload as well), it is a more performing alternative to a reflection based CommandTargetResolvers.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
VersionedAggregateIdentifier |
resolveTarget(CommandMessage<?> command)
Returns the Aggregate Identifier and optionally the expected version of the aggregate on which the given command should be executed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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 IllegalArgumentException
identifierKey
- 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 IllegalArgumentException
identifierKey
- 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 versionMethod Detail |
---|
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 version
VersionedAggregateIdentifier
instance reflecting the aggregate to execute the command on
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |