Interface SnapshotCapable

All Known Subinterfaces:
AggregatedPoint<V,A>, AtomicPoint<V>, DataPoint<V>
All Known Implementing Classes:
AggregatedDataPoint

public sealed interface SnapshotCapable permits DataPoint<V>
Represents an entity capable of creating and managing snapshots.

This sealed interface defines the contract for snapshot-capable entities and restricts its implementations to the DataPoint subtype.

  • Method Details

    • snapshotTimestamp

      Optional<Instant> snapshotTimestamp()
      Retrieves the timestamp of the snapshot, if available.
      Returns:
      An Optional containing the snapshot timestamp, or an empty Optional if no snapshot is present.
    • isSnapshot

      default boolean isSnapshot()
      Checks if this entity represents a snapshot.
      Returns:
      true if a snapshot timestamp is present, false otherwise.
    • withSnapshot

      default SnapshotCapable withSnapshot()
      Creates a snapshot of this entity at the current time.
      Returns:
      A new instance of SnapshotCapable with the current timestamp as the snapshot time.
    • withSnapshot

      SnapshotCapable withSnapshot(Instant timestamp)
      Creates a snapshot of this entity at the specified time.
      Parameters:
      timestamp - The timestamp to use for the snapshot.
      Returns:
      A new instance of SnapshotCapable with the specified snapshot time.