public class ConflictResolution extends Object implements ParameterResolverFactory, ParameterResolver<ConflictResolver>
Conflict resolution can be initialized by passing a ConflictResolver
to the static initialize(ConflictResolver)
method. Note that a UnitOfWork
needs
to be active before conflict resolution can be initialized.
Constructor and Description |
---|
ConflictResolution() |
Modifier and Type | Method and Description |
---|---|
ParameterResolver |
createInstance(Executable executable,
Parameter[] parameters,
int parameterIndex)
If available, creates a ParameterResolver instance that can provide a parameter of type
parameterType for a given message. |
static ConflictResolver |
getConflictResolver()
Returns the ConflictResolver instance that can be used to resolve conflicts of an Aggregate that has been
previously loaded in this Unit of Work.
|
static void |
initialize(ConflictResolver conflictResolver)
Initialize conflict resolution in the context of the current Unit of Work dealing with a command on an event
sourced aggregate.
|
boolean |
matches(Message<?> message)
Indicates whether this resolver is capable of providing a value for the given
message . |
ConflictResolver |
resolveParameterValue(Message<?> message)
Resolves the parameter value to use for the given
message , or null if no suitable
parameter value can be resolved. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
supportedPayloadType
public static void initialize(ConflictResolver conflictResolver)
conflictResolver
- conflict resolver able to detect conflictspublic static ConflictResolver getConflictResolver()
ConflictResolver
that was registered last, is returned.
Any conflicts must be resolved (by invoking one of the methods on ConflictResolver
) before the Unit of
Work is committed.
If no Aggregate was loaded, or no conflicts are present, this method will return a NoConflictResolver
,
instance.
public ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex)
ParameterResolverFactory
parameterType
for a given message.
If the ParameterResolverFactory cannot provide a suitable ParameterResolver, returns null
.
createInstance
in interface ParameterResolverFactory
executable
- The executable (constructor or method) to inspectparameters
- The parameters on the executable to inspectparameterIndex
- The index of the parameter to return a ParameterResolver fornull
if none is foundpublic ConflictResolver resolveParameterValue(Message<?> message)
ParameterResolver
message
, or null
if no suitable
parameter value can be resolved.resolveParameterValue
in interface ParameterResolver<ConflictResolver>
message
- The message to resolve the value frompublic boolean matches(Message<?> message)
ParameterResolver
message
.matches
in interface ParameterResolver<ConflictResolver>
message
- The message to evaluatetrue
if this resolver can provide a value for the message, otherwise false
Copyright © 2010–2018. All rights reserved.