Interface ExpressionEvaluator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
The engine calls this SPI to evaluate ${expr} placeholders found
in DSL fields (e.g. transition when guards, assignee values).
Implementations are typically thin adapters over SpEL, MVEL, OGNL, Aviator,
etc.
引擎在求值 DSL 中的 ${expr} 占位符(如 transition 的 when
守卫、assignee 取值等)时调用本 SPI。实现通常是 SpEL / MVEL / OGNL /
Aviator 等表达式引擎的薄适配。
Security requirement (/sec P1, MANDATORY): implementations MUST use a sandboxed evaluation environment:
- SpEL implementations MUST use
SimpleEvaluationContext;StandardEvaluationContextis forbidden. - Type references
T(...), constructor invocationsnew, and reflective access such as#this.classMUST be disabled. - When the DSL source is untrusted (e.g. form-based import) the implementation SHOULD further restrict accessible root-object fields.
安全要求(/sec P1,强制):实现方必须使用受限的求值环境:
- SpEL 实现必须使用
SimpleEvaluationContext,禁用StandardEvaluationContext。 - 禁止类型引用
T(...)、构造函数new、反射#this.class。 - 当 DSL 来源不可信时(如表单导入)应进一步限制可访问的 root 对象字段。
This component does not provide a default implementation; the host is solely responsible for the safety of its implementation. An unsafe implementation will expose the application to CVE-2022-22963 / CVE-2022-22965-class remote-code-execution risks.
本组件不提供默认实现,宿主对自身实现的安全性负全责。 不安全实现将导致 CVE-2022-22963 / CVE-2022-22965 类 RCE 风险。
- Since:
- JDK 25, opencode-base-flow V1.0.5
- Author:
- Leon Soo
-
Method Summary
Modifier and TypeMethodDescriptionevaluate(String expression, FlowContext ctx) Evaluates the given expression against the suppliedFlowContext.
-
Method Details
-
evaluate
Evaluates the given expression against the suppliedFlowContext. 在给定FlowContext下对表达式求值。- Parameters:
expression- the expression source (without the${...}wrapper) — 去除${...}包裹后的表达式源码ctx- the current flow context — 当前流程上下文- Returns:
- the evaluation result; may be
null— 求值结果,允许null - Since:
- JDK 25, opencode-base-flow V1.0.5
-