All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.rahulsom.grooves.api.snapshots.Snapshot Maven / Gradle / Ivy

package com.github.rahulsom.grooves.api.snapshots;

import com.github.rahulsom.grooves.api.AggregateType;
import com.github.rahulsom.grooves.api.events.BaseEvent;

/**
 * Marks a class as a snapshot. This supports both temporal and versioned access.
 *
 * @param   The Aggregate this snapshot works over
 * @param  The type for the snapshot's {@link #getId()} field
 * @param     The type for the {@link EventT}'s id field
 * @param       The base type for events that apply to {@link AggregateT}
 *
 * @author Rahul Somasunderam
 */
public interface Snapshot<
        AggregateT extends AggregateType, SnapshotIdT, EventIdT,
        EventT extends BaseEvent>
        extends
        VersionedSnapshot,
        TemporalSnapshot {

    @Override
    default void setLastEvent(EventT aidBaseEvent) {
        this.setLastEventTimestamp(aidBaseEvent.getTimestamp());
        this.setLastEventPosition(aidBaseEvent.getPosition());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy