com.github.rahulsom.grooves.queries.JoinSupport Maven / Gradle / Ivy
package com.github.rahulsom.grooves.queries;
import com.github.rahulsom.grooves.api.AggregateType;
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.BaseQuery;
import com.github.rahulsom.grooves.queries.internal.Executor;
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 {@link EventT}'s id field
* @param The base type for events that apply to {@link AggregateT}
* @param The type for the join's id field
* @param The type for the other id of aggregate that {@link AggregateT} joins
* to
* @param The type for the other aggregate that {@link 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<
AggregateIdT,
AggregateT extends AggregateType,
EventIdT,
EventT extends BaseEvent,
JoinedAggregateIdT,
JoinedAggregateT extends AggregateType,
SnapshotIdT,
SnapshotT extends Join,
JoinEventT extends JoinEvent,
DisjoinEventT extends DisjoinEvent,
QueryT extends
BaseQuery>
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