Record Class SourcingStrategy.Snapshot
java.lang.Object
java.lang.Record
org.axonframework.eventsourcing.eventstore.SourcingStrategy.Snapshot
- Record Components:
qualifiedName- theQualifiedNamedefining the snapshot type, cannot benullidentifier- the identifier of the snapshotted entity, cannot benullmaximumPosition- the maximum position of the snapshot to return, can benull
- All Implemented Interfaces:
SourcingStrategy
- Enclosing interface:
SourcingStrategy
public static record SourcingStrategy.Snapshot(QualifiedName qualifiedName, Object identifier, @Nullable Position maximumPosition)
extends Record
implements SourcingStrategy
Snapshot-based sourcing strategy.
This strategy provides an initial state (snapshot) if available, succeeded by an ordered event stream from the position of the snapshot.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.axonframework.eventsourcing.eventstore.SourcingStrategy
SourcingStrategy.Absolute, SourcingStrategy.Snapshot -
Constructor Summary
ConstructorsConstructorDescriptionSnapshot(QualifiedName qualifiedName, Object identifier, @Nullable Position maximumPosition) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theidentifierrecord component.@Nullable PositionReturns the value of themaximumPositionrecord component.merge(SourcingStrategy other) Merges this sourcing strategy with another sourcing strategy to produce a single effective strategy for event sourcing.Returns the value of thequalifiedNamerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Snapshot
Constructs a new instance.- Throws:
NullPointerException- ifqualifiedNameoridentifierisnull
-
-
Method Details
-
merge
Description copied from interface:SourcingStrategyMerges this sourcing strategy with another sourcing strategy to produce a single effective strategy for event sourcing.The merge operation is deterministic and defined as follows:
- Merging two
SourcingStrategy.Absolutestrategies results in anAbsolutewhose position is the minimum of both positions - Merging an
SourcingStrategy.Absolutewith aSourcingStrategy.Snapshotresults in theSnapshot - Merging two
SourcingStrategy.Snapshotinstances is not supported and results in anUnsupportedOperationException
- Specified by:
mergein interfaceSourcingStrategy- Parameters:
other- the other sourcing strategy to merge with this one, cannot benull- Returns:
- the merged sourcing strategy
- Merging two
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
qualifiedName
Returns the value of thequalifiedNamerecord component.- Returns:
- the value of the
qualifiedNamerecord component
-
identifier
Returns the value of theidentifierrecord component.- Returns:
- the value of the
identifierrecord component
-
maximumPosition
Returns the value of themaximumPositionrecord component.- Returns:
- the value of the
maximumPositionrecord component
-