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

com.github.rahulsom.grooves.queries.JoinSupport Maven / Gradle / Ivy

package com.github.rahulsom.grooves.queries;

import com.github.rahulsom.grooves.api.events.BaseEvent;
import com.github.rahulsom.grooves.api.events.DisjoinEvent;
import com.github.rahulsom.grooves.api.events.JoinEvent;
import com.github.rahulsom.grooves.api.snapshots.Join;
import com.github.rahulsom.grooves.queries.internal.JoinExecutor;
import org.jetbrains.annotations.NotNull;
import org.reactivestreams.Publisher;

/**
 * Default interface that makes joins easier to write.
 *
 * @param          The Aggregate this join represents
 * @param            The type for the EventT's id field
 * @param              The base type for events that apply to AggregateT
 * @param         The type for the join's id field
 * @param    The type for the other aggregate that AggregateT joins to
 * @param           The type of Snapshot that is computed
 * @param          The type of the Join Event
 * @param       The type of the disjoin event
 *
 * @author Rahul Somasunderam
 */
public interface JoinSupport<
        AggregateT,
        EventIdT,
        EventT extends BaseEvent,
        JoinedAggregateT,
        SnapshotIdT,
        SnapshotT extends Join,
        JoinEventT extends JoinEvent,
        DisjoinEventT extends DisjoinEvent
        > extends
        VersionedJoinSupport,
        TemporalJoinSupport {

    @NotNull
    @Override
    default JoinExecutor getExecutor() {
        return new JoinExecutor<>(getJoinEventClass(), getDisjoinEventClass());
    }

    @NotNull
    @Override
    default Publisher findEventsBefore(@NotNull EventT event) {
        return VersionedJoinSupport.super.findEventsBefore(event);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy