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 — 业务 keycurrentStepId- 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;nullduring DSL deploy / validate stages.flowKey— always present.currentStepId— the step currently being evaluated; may benullat instance bootstrap.initiatorId— the user who started the instance; may benullduring deploy-time validation.variables— business variables snapshot copied to an immutable map; nevernull(an empty map is used when the caller passesnull).
各字段语义:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecurrentStepIdrecord component.final booleanIndicates whether some other object is "equal to" this one.flowKey()Returns the value of theflowKeyrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theinitiatorIdrecord component.Returns the value of theinstanceIdrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thevariablesrecord component.
-
Constructor Details
-
FlowContext
public FlowContext(String instanceId, String flowKey, String currentStepId, String initiatorId, Map<String, Object> variables) Compact constructor: defensively copiesvariablesinto an immutable map (Map.of()whennull). 紧凑构造器:对variables做不可变拷贝(null时退化为Map.of())。- Since:
- JDK 25, opencode-base-flow V1.0.5
-
-
Method Details
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
instanceId
Returns the value of theinstanceIdrecord component.- Returns:
- the value of the
instanceIdrecord component
-
flowKey
-
currentStepId
Returns the value of thecurrentStepIdrecord component.- Returns:
- the value of the
currentStepIdrecord component
-
initiatorId
Returns the value of theinitiatorIdrecord component.- Returns:
- the value of the
initiatorIdrecord component
-
variables
-