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

com.codepoetics.fluvius.flows.SingleOperationFlow Maven / Gradle / Ivy

There is a newer version: 1.10
Show newest version
package com.codepoetics.fluvius.flows;

import com.codepoetics.fluvius.api.Condition;
import com.codepoetics.fluvius.api.Flow;
import com.codepoetics.fluvius.api.FlowVisitor;
import com.codepoetics.fluvius.api.Operation;
import com.codepoetics.fluvius.api.scratchpad.Key;

import java.util.Set;
import java.util.UUID;

final class SingleOperationFlow extends AbstractFlow {

  static  Flow create(Set> requiredKeys, Key providedKey, Operation operation) {
    return new SingleOperationFlow<>(UUID.randomUUID(), requiredKeys, providedKey, operation);
  }

  private final Operation operation;

  private SingleOperationFlow(UUID stepId, Set> requiredKeys, Key providedKeys, Operation operation) {
    super(stepId, requiredKeys, providedKeys);
    this.operation = operation;
  }

  @Override
  public  V visit(FlowVisitor visitor) {
    return visitor.visitSingle(getStepId(), getRequiredKeys(), getProvidedKey(), operation);
  }

  @Override
  public  Flow then(Flow next) {
    return SequenceFlow.create(this, next);
  }

  @Override
  public Flow orIf(Condition condition, Flow ifTrue) {
    return BranchFlow.create(this, condition, ifTrue);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy