Record Class CollectionProjectNode
java.lang.Object
java.lang.Record
cloud.opencode.base.expression.ast.CollectionProjectNode
- Record Components:
target- the target collection node | 目标集合节点projection- the projection expression | 投影表达式
- All Implemented Interfaces:
Node
Collection Project Node
集合投影节点
Represents collection projection: users.![name]
表示集合投影:users.![name]
Features | 主要功能:
- Project/map a collection to extract a property from each element - 投影/映射集合以从每个元素提取属性
- Child context with #this binding per element - 每个元素绑定#this的子上下文
Usage Examples | 使用示例:
// Extract all user names: users.![name]
Node projection = CollectionProjectNode.of(usersNode, nameNode);
List<?> names = (List<?>) projection.evaluate(ctx);
Security | 安全性:
- Thread-safe: Yes, immutable record - 线程安全: 是,不可变记录
- Null-safe: Yes, null target returns empty list - 空值安全: 是,null目标返回空列表
- Since:
- JDK 25, opencode-base-expression V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCollectionProjectNode(Node target, Node projection) Creates an instance of aCollectionProjectNoderecord class. -
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.static CollectionProjectNodeCreate projection node 创建投影节点Returns the value of theprojectionrecord component.target()Returns the value of thetargetrecord component.Get string representation for debugging 获取用于调试的字符串表示final StringtoString()Returns a string representation of this record class.Methods inherited from interface Node
getTypeName
-
Constructor Details
-
CollectionProjectNode
Creates an instance of aCollectionProjectNoderecord class.- Parameters:
target- the value for thetargetrecord componentprojection- the value for theprojectionrecord component
-
-
Method Details
-
of
Create projection node 创建投影节点- Parameters:
target- the target node | 目标节点projection- the projection expression | 投影表达式- Returns:
- the projection 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). -
target
-
projection
Returns the value of theprojectionrecord component.- Returns:
- the value of the
projectionrecord component
-