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

com.codepoetics.fluvius.api.FlowVisitor Maven / Gradle / Ivy

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

import com.codepoetics.fluvius.api.scratchpad.Key;

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

/**
 * Visits a Flow and all of its sub-flows to construct a value, such as an Action or FlowDescription, which represents something we might want to do with the Flow, e.g. execute or describe it.
 *
 * @param  The type of the value constructed by this FlowVisitor.
 */
public interface FlowVisitor {

  /**
   * Called when this FlowVisitor visits a Flow which executes a single Operation.
   *
   * @param stepId              The unique step ID of the visited Flow.
   * @param requiredKeys The Keys required by the visited Flow.
   * @param providedKey  The Key provided by the visited Flow.
   * @param operation    The Operation executed by the visited Flow.
   * @param           The type of the value returned by the Operation.
   * @return The constructed value.
   */
   V visitSingle(UUID stepId, Set> requiredKeys, Key providedKey, Operation operation);

  /**
   * Called when this FlowVisitor visits a Flow which sequences two or more sub-flows.
   *
   * @param stepId              The unique step ID of the visited Flow.
   * @param requiredKeys The Keys required by the visited Flow.
   * @param providedKey  The Key provided by the visited Flow.
   * @param items        The values constructed by visiting all of the sub-flows of this Flow with this FlowVisitor.
   * @param           The type of the value returned by the visited Flow.
   * @return The constructed value.
   */
   V visitSequence(UUID stepId, Set> requiredKeys, Key providedKey, List items);

  /**
   * Called when this FlowVisitor visits a Flow which branches between two or more conditional sub-flows.
   *
   * @param stepId              The unique step ID of the visited Flow.
   * @param requiredKeys        The Keys required by the visited Flow.
   * @param providedKey         The Key provided by the visited Flow.
   * @param defaultBranch       The value constructed by visiting the default branch with this FlowVisitor.
   * @param conditionalBranches The values constructed by visiting the conditional branches with this FlowVisitor.
   * @param                  The type of the value returned by the visited Flow.
   * @return The constructed value.
   */
   V visitBranch(UUID stepId, Set> requiredKeys, Key providedKey, V defaultBranch, List> conditionalBranches);

  /**
   * Called when this FlowVisitor visits a Condition. This may be used to decorate a Condition, e.g. with logging behaviour.
   *
   * @param condition The visited Condition.
   * @return The decorated Condition.
   */
  Condition visitCondition(Condition condition);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy