Class Conflicts
java.lang.Object
org.axonframework.eventsourcing.conflictresolution.Conflicts
Utility class providing common Predicates used to detect conflicts between the actual state of an event sourced
aggregate and the expected state of the aggregate.
- Author:
- Rene de Waele
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends EventMessage<?>>
Predicate<List<T>> eventMatching(Predicate<? super T> messageFilter) Returns aPredicatefor aConflictResolverthat responds affirmative if any event in a list of unseen events matches the givenmessageFilter.static <T> Predicate<List<DomainEventMessage<?>>> payloadMatching(Class<T> payloadType, Predicate<? super T> payloadFilter) Returns aPredicatefor aConflictResolverthat responds affirmative if the payload of any event in a list of unseen events is of givenpayloadTypeand matches the givenmessageFilter.static Predicate<List<DomainEventMessage<?>>> payloadMatching(Predicate<Object> payloadFilter) Returns aPredicatefor aConflictResolverthat responds affirmative if the payload of any event in a list of unseen events matches the givenmessageFilter.static <T> Predicate<List<DomainEventMessage<?>>> payloadTypeOf(Class<T> payloadType) Returns aPredicatefor aConflictResolverthat responds affirmative if the payload type of any event in a list of unseen events is assignable to givenpayloadType.
-
Method Details
-
eventMatching
public static <T extends EventMessage<?>> Predicate<List<T>> eventMatching(Predicate<? super T> messageFilter) Returns aPredicatefor aConflictResolverthat responds affirmative if any event in a list of unseen events matches the givenmessageFilter. If the returned predicate matches an unseen event the ConflictResolver will throw an exception.- Parameters:
messageFilter- predicate for a single event- Returns:
- a Predicate to detect conflicts in unseen aggregate events
-
payloadMatching
public static Predicate<List<DomainEventMessage<?>>> payloadMatching(Predicate<Object> payloadFilter) Returns aPredicatefor aConflictResolverthat responds affirmative if the payload of any event in a list of unseen events matches the givenmessageFilter. If the returned predicate matches an unseen event the ConflictResolver will throw an exception.- Parameters:
payloadFilter- predicate for the payload of a single event- Returns:
- a Predicate to detect conflicts in unseen aggregate events
-
payloadMatching
public static <T> Predicate<List<DomainEventMessage<?>>> payloadMatching(Class<T> payloadType, Predicate<? super T> payloadFilter) Returns aPredicatefor aConflictResolverthat responds affirmative if the payload of any event in a list of unseen events is of givenpayloadTypeand matches the givenmessageFilter. If the returned predicate matches an unseen event the ConflictResolver will throw an exception.- Parameters:
payloadType- the type of event payload to filter forpayloadFilter- predicate for the payload of a single event- Returns:
- a Predicate to detect conflicts in unseen aggregate events
-
payloadTypeOf
Returns aPredicatefor aConflictResolverthat responds affirmative if the payload type of any event in a list of unseen events is assignable to givenpayloadType. If the returned predicate matches an unseen event the ConflictResolver will throw an exception.- Parameters:
payloadType- the type of event payload to filter for- Returns:
- a Predicate to detect conflicts in unseen aggregate events
-