Record Class IdentifierNode
java.lang.Object
java.lang.Record
cloud.opencode.base.expression.ast.IdentifierNode
- Record Components:
name- the identifier name | 标识符名称
- All Implemented Interfaces:
Node
Identifier Node
标识符节点
Represents variable references in expressions.
表示表达式中的变量引用。
Features | 主要功能:
- Variable lookup with # prefix support - 支持#前缀的变量查找
- Special identifiers: #root, #this - 特殊标识符: #root, #this
- Fallback to root object property access - 回退到根对象属性访问
Usage Examples | 使用示例:
Node id = IdentifierNode.of("name");
ctx.setVariable("name", "John");
Object result = id.evaluate(ctx); // "John"
Node root = IdentifierNode.of("#root");
Object rootObj = root.evaluate(ctx);
Security | 安全性:
- Thread-safe: Yes, immutable record - 线程安全: 是,不可变记录
- Null-safe: No, null/blank name rejected at construction - 空值安全: 否,null/空名称在构造时被拒绝
- Since:
- JDK 25, opencode-base-expression V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.evaluate(EvaluationContext context) Evaluate this node 求值此节点final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.static IdentifierNodeCreate identifier node 创建标识符节点Get string representation for debugging 获取用于调试的字符串表示final StringtoString()Returns a string representation of this record class.Methods inherited from interface Node
getTypeName
-
Constructor Details
-
IdentifierNode
Create identifier node 创建标识符节点- Parameters:
name- the identifier name | 标识符名称
-
-
Method Details
-
of
Create identifier node 创建标识符节点- Parameters:
name- the identifier name | 标识符名称- Returns:
- the identifier node | 标识符节点
-
evaluate
Description copied from interface:NodeEvaluate this node 求值此节点 -
toExpressionString
Description copied from interface:NodeGet string representation for debugging 获取用于调试的字符串表示- Specified by:
toExpressionStringin interfaceNode- Returns:
- the string representation | 字符串表示
-
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). -
name
-