java.lang.Object
org.axonframework.eventsourcing.conflictresolution.Conflicts

public class Conflicts extends Object
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 Details

    • eventMatching

      public static <T extends EventMessage<?>> Predicate<List<T>> eventMatching(Predicate<? super T> messageFilter)
      Returns a Predicate for a ConflictResolver that responds affirmative if any event in a list of unseen events matches the given messageFilter. 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 a Predicate for a ConflictResolver that responds affirmative if the payload of any event in a list of unseen events matches the given messageFilter. 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 a Predicate for a ConflictResolver that responds affirmative if the payload of any event in a list of unseen events is of given payloadType and matches the given messageFilter. If the returned predicate matches an unseen event the ConflictResolver will throw an exception.
      Parameters:
      payloadType - the type of event payload to filter for
      payloadFilter - predicate for the payload of a single event
      Returns:
      a Predicate to detect conflicts in unseen aggregate events
    • payloadTypeOf

      public static <T> Predicate<List<DomainEventMessage<?>>> payloadTypeOf(Class<T> payloadType)
      Returns a Predicate for a ConflictResolver that responds affirmative if the payload type of any event in a list of unseen events is assignable to given payloadType. 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