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

com.github.rahulsom.grooves.api.snapshots.VersionedSnapshot 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;
import com.github.rahulsom.grooves.api.snapshots.internal.BaseSnapshot;

/**
 * Marks a class as a versioned snapshot.
 *
 * @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 VersionedSnapshot<
        AggregateT extends AggregateType,
        SnapshotIdT,
        EventIdT,
        EventT extends BaseEvent>
        extends BaseSnapshot {

    Long getLastEventPosition();

    void setLastEventPosition(Long id);

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy