Class IfNode

java.lang.Object
cloud.opencode.base.string.template.node.IfNode
All Implemented Interfaces:
TemplateNode

public final class IfNode extends Object implements TemplateNode
If Node - Template node for conditional rendering. 条件节点 - 用于条件渲染的模板节点。

Features | 主要功能:

  • Condition-based then/else branch rendering - 基于条件的then/else分支渲染
  • Truthiness evaluation of context variables - 上下文变量真值评估

Usage Examples | 使用示例:

IfNode node = new IfNode("showName", thenNodes, elseNodes);
String result = node.render(Map.of("showName", true));

Security | 安全性:

  • Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
Since:
JDK 25, opencode-base-string V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also: