| 1 | package com.reallifedeveloper.common.application.eventstore; | |
| 2 | ||
| 3 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | |
| 4 | ||
| 5 | import com.reallifedeveloper.common.domain.ErrorHandling; | |
| 6 | import com.reallifedeveloper.common.domain.event.DomainEvent; | |
| 7 | import com.reallifedeveloper.common.domain.event.DomainEventSubscriber; | |
| 8 | ||
| 9 | /** | |
| 10 | * A {@link DomainEventSubscriber} that stores all events using a {@link EventStore}. | |
| 11 | * | |
| 12 | * @author RealLifeDeveloper | |
| 13 | */ | |
| 14 | public final class EventStoringSubscriber implements DomainEventSubscriber<DomainEvent> { | |
| 15 | ||
| 16 | private final EventStore eventStore; | |
| 17 | ||
| 18 | /** | |
| 19 | * Creates a new {@code EventStoringSubscriber} that uses the given {@link EventStore}. | |
| 20 | * | |
| 21 | * @param eventStore the {@code EventStore} to use | |
| 22 | */ | |
| 23 | @SuppressFBWarnings("EI_EXPOSE_REP2") | |
| 24 | public EventStoringSubscriber(EventStore eventStore) { | |
| 25 |
1
1. <init> : removed call to com/reallifedeveloper/common/domain/ErrorHandling::checkNull → SURVIVED |
ErrorHandling.checkNull("eventStore must not be null", eventStore); |
| 26 | this.eventStore = eventStore; | |
| 27 | } | |
| 28 | ||
| 29 | @Override | |
| 30 | public void handleEvent(DomainEvent event) { | |
| 31 | eventStore.add(event); | |
| 32 | } | |
| 33 | ||
| 34 | @Override | |
| 35 | public Class<? extends DomainEvent> eventType() { | |
| 36 |
1
1. eventType : replaced return value with null for com/reallifedeveloper/common/application/eventstore/EventStoringSubscriber::eventType → KILLED |
return DomainEvent.class; |
| 37 | } | |
| 38 | ||
| 39 | } | |
Mutations | ||
| 25 |
1.1 |
|
| 36 |
1.1 |