Interface ConflictResolver
- All Known Implementing Classes:
DefaultConflictResolver,NoConflictResolver
ConflictingModificationException (or subtype) is thrown.- Author:
- Rene de Waele, Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptiondefault voiddetectConflicts(Predicate<List<DomainEventMessage<?>>> predicate) Resolve conflicts between changes to be applied to the aggregate and unseen changes made to the aggregate.default <T extends Exception>
voiddetectConflicts(Predicate<List<DomainEventMessage<?>>> predicate, ConflictExceptionSupplier<T> exceptionSupplier) Resolve conflicts between unseen changes made to the aggregate and new changes that are about to be made.<T extends Exception>
voiddetectConflicts(Predicate<List<DomainEventMessage<?>>> predicate, ContextAwareConflictExceptionSupplier<T> exceptionSupplier) Resolve conflicts between unseen changes made to the aggregate and new changes that are about to be made.
-
Method Details
-
detectConflicts
default <T extends Exception> void detectConflicts(Predicate<List<DomainEventMessage<?>>> predicate, ConflictExceptionSupplier<T> exceptionSupplier) throws T Resolve conflicts between unseen changes made to the aggregate and new changes that are about to be made.Conflicts are detected using the given
predicate. If thePredicate.test(Object)method returnstruea conflict is registered. If a conflict is registered an instance ofConflictingModificationException(or subtype) is thrown immediately. The cause of the exception is supplied by the givencauseSupplier(supplying anullcause is allowed).- Parameters:
predicate- test for conflicting unseen changes. Returnstrueif there is a conflict.exceptionSupplier- exception to throw when a conflict is detected- Throws:
T- The type of exception to throw when conflicts are detected
-
detectConflicts
Resolve conflicts between changes to be applied to the aggregate and unseen changes made to the aggregate.Conflicts are detected using the given
predicate. If thePredicate.test(Object)method returnstruea conflict is registered. If a conflict is registered an instance ofConflictingModificationException(or subtype) without cause is thrown immediately.- Parameters:
predicate- test for conflicting unseen changes. Returnstrueif there is a conflict.
-
detectConflicts
<T extends Exception> void detectConflicts(Predicate<List<DomainEventMessage<?>>> predicate, ContextAwareConflictExceptionSupplier<T> exceptionSupplier) throws T Resolve conflicts between unseen changes made to the aggregate and new changes that are about to be made.Conflicts are detected using the given
predicate. If thePredicate.test(Object)method returnstruea conflict is registered. If a conflict is registered an instance ofConflictingModificationException(or subtype) is thrown immediately. The cause of the exception is supplied by the givencauseSupplier(supplying anullcause is allowed).- Parameters:
predicate- test for conflicting unseen changes. Returnstrueif there is a conflict.exceptionSupplier- exception to throw when a conflict is detected- Throws:
T- The type of exception to throw when conflicts are detected
-