@FunctionalInterface public interface SnapshotFilter extends Predicate<DomainEventData<?>>
allow(DomainEventData)
method to take snapshot data into account when
loading an aggregate. When providing an instance of this, take the following into account:
false
if the snapshot data belongs to the corresponding aggregate and it does no conform to the desired format.true
if the snapshot data belongs to the corresponding aggregate and conforms to the desired format.true
if the snapshot data does not correspond to the desired aggregate.
Whether the DomainEventData
corresponds to the right aggregate and is of the desired format, is dependent on
the Snapshotter
instance being used. By default, the AggregateSnapshotter
instances would be used.
In such a default set up, DomainEventData
corresponding to the right aggregate means that the DomainEventData.getType()
matches the aggregate's type. If DomainEventData
is of the desired format
should be based on the EventData.getPayload()
, which contains the entire aggregate state.
Modifier and Type | Method and Description |
---|---|
default boolean |
allow(DomainEventData<?> snapshotData)
Function applied to filter out snapshot data in the form of a
DomainEventData . |
static SnapshotFilter |
allowAll()
A
SnapshotFilter implementation which allows all snapshots. |
default SnapshotFilter |
combine(SnapshotFilter other)
Combines
this SnapshotFilter with the give other filter in an "AND" operation,
effectively validating whether both return true on a allow(DomainEventData) call of each. |
static SnapshotFilter |
rejectAll()
A
SnapshotFilter implementation which rejects all snapshots. |
default boolean allow(DomainEventData<?> snapshotData)
DomainEventData
. Return true
if the
data should be kept and false
if it should be dropped.snapshotData
- the snapshot data to verify for filteringtrue
if the data should be kept and false
if it should be droppeddefault SnapshotFilter combine(SnapshotFilter other)
this
SnapshotFilter
with the give other
filter in an "AND" operation,
effectively validating whether both return true
on a allow(DomainEventData)
call of each.other
- another SnapshotFilter
instance to combine with this
filter in an "AND" operationSnapshotFilter
combining the this
and other
filters in an "AND" operationstatic SnapshotFilter allowAll()
SnapshotFilter
implementation which allows all snapshots.SnapshotFilter
implementation which allows all snapshotsstatic SnapshotFilter rejectAll()
SnapshotFilter
implementation which rejects all snapshots.SnapshotFilter
implementation which rejects all snapshotsCopyright © 2010–2022. All rights reserved.