Record Class FlowContext

java.lang.Object
java.lang.Record
cloud.opencode.base.flow.spi.FlowContext
Record Components:
instanceId - instance id (nullable at deploy / validate stage) — 实例 ID(部署/校验阶段可为 null)
flowKey - business flow key — 业务 key
currentStepId - current step id (nullable) — 当前节点(可空)
initiatorId - initiator user id (nullable) — 发起人(可空)
variables - immutable business variables snapshot — 业务变量快照(不可变)

public record FlowContext(String instanceId, String flowKey, String currentStepId, String initiatorId, Map<String,Object> variables) extends Record
Read-only context passed to every SPI implementation (AssigneeResolver, ExpressionEvaluator). 透传给每个 SPI 实现(AssigneeResolver、ExpressionEvaluator)的只读上下文。

The context carries the currently-known coordinates of the running flow call. Field semantics:

  • instanceId — present once the instance has been persisted; null during DSL deploy / validate stages.
  • flowKey — always present.
  • currentStepId — the step currently being evaluated; may be null at instance bootstrap.
  • initiatorId — the user who started the instance; may be null during deploy-time validation.
  • variables — business variables snapshot copied to an immutable map; never null (an empty map is used when the caller passes null).

各字段语义:

  • instanceId —— 实例持久化后填入;DSL 部署/校验阶段为 null。
  • flowKey —— 必填。
  • currentStepId —— 当前节点,实例启动阶段可为 null。
  • initiatorId —— 发起人;部署期校验阶段可为 null。
  • variables —— 业务变量快照,构造期拷贝为不可变 Map; 永不为 null(传入 null 时使用空 Map)。
Since:
JDK 25, opencode-base-flow V1.0.5
Author:
Leon Soo
  • Constructor Details

    • FlowContext

      public FlowContext(String instanceId, String flowKey, String currentStepId, String initiatorId, Map<String,Object> variables)
      Compact constructor: defensively copies variables into an immutable map (Map.of() when null). 紧凑构造器:对 variables 做不可变拷贝(null 时退化为 Map.of())。
      Since:
      JDK 25, opencode-base-flow V1.0.5
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • instanceId

      public String instanceId()
      Returns the value of the instanceId record component.
      Returns:
      the value of the instanceId record component
    • flowKey

      public String flowKey()
      Returns the value of the flowKey record component.
      Returns:
      the value of the flowKey record component
    • currentStepId

      public String currentStepId()
      Returns the value of the currentStepId record component.
      Returns:
      the value of the currentStepId record component
    • initiatorId

      public String initiatorId()
      Returns the value of the initiatorId record component.
      Returns:
      the value of the initiatorId record component
    • variables

      public Map<String,Object> variables()
      Returns the value of the variables record component.
      Returns:
      the value of the variables record component