com.fluxtion.compiler.builder.dataflow.MultiJoinBuilder Maven / Gradle / Ivy
package com.fluxtion.compiler.builder.dataflow;
import com.fluxtion.runtime.EventProcessorBuilderService;
import com.fluxtion.runtime.dataflow.groupby.MultiJoin;
import com.fluxtion.runtime.partition.LambdaReflection;
/**
* Builds a co-group or multi leg join
*
* @param The key type for join stream
* @param Target type of results for multi join
*/
public class MultiJoinBuilder {
private final MultiJoin multiLegJoin;
public MultiJoinBuilder(Class keyClass, LambdaReflection.SerializableSupplier target) {
multiLegJoin = new MultiJoin<>(keyClass, target);
}
public static MultiJoinBuilder builder(Class keyClass, LambdaReflection.SerializableSupplier target) {
return new MultiJoinBuilder<>(keyClass, target);
}
public MultiJoinBuilder addJoin(
GroupByFlowBuilder flow1,
LambdaReflection.SerializableBiConsumer setter1) {
multiLegJoin.addJoin(flow1.flowSupplier(), setter1);
return this;
}
public MultiJoinBuilder addOptionalJoin(
GroupByFlowBuilder flow1,
LambdaReflection.SerializableBiConsumer setter1) {
multiLegJoin.addOptionalJoin(flow1.flowSupplier(), setter1);
return this;
}
public GroupByFlowBuilder dataFlow() {
EventProcessorBuilderService.service().add(multiLegJoin);
return new GroupByFlowBuilder<>(multiLegJoin);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy