Record Class Snapshot
java.lang.Object
java.lang.Record
org.axonframework.eventsourcing.snapshot.api.Snapshot
- Record Components:
position- the position in the event stream corresponding to this snapshot, nevernullversion- the entity's version at the time of this snapshot, nevernullpayload- the payload to associate with the snapshot, nevernulltimestamp- the timestamp to associate with the snapshot, nevernullmetadata- the metadata to associate with the snapshot, nevernull
public record Snapshot(Position position, String version, Object payload, Instant timestamp, Map<String,String> metadata)
extends Record
Represents a snapshot of an entity at a specific position in the event stream.
A snapshot captures the state of the entity at a given point, allowing the entity to be sourced from this state instead of from scratch.
- Since:
- 5.1.0
- Author:
- John Hendrikx
-
Constructor Summary
Constructors -
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.metadata()Returns the value of themetadatarecord component.payload()Returns the value of thepayloadrecord component.Creates a copy of this snapshot with the given payload.position()Returns the value of thepositionrecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.version()Returns the value of theversionrecord component.
-
Constructor Details
-
Method Details
-
payload
Creates a copy of this snapshot with the given payload.- Parameters:
payload- the new payload, cannot benull- Returns:
- a new snapshot, never
null
-
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). -
position
Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-
version
Returns the value of theversionrecord component.- Returns:
- the value of the
versionrecord component
-
payload
Returns the value of thepayloadrecord component.- Returns:
- the value of the
payloadrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-