Package dev.vortex.api.expressions
Class Root
java.lang.Object
dev.vortex.api.expressions.Root
- All Implemented Interfaces:
Expression
Represents the root expression in a Vortex expression tree.
This is a singleton expression that serves as the starting point for expression evaluation,
typically representing the root context or input data from which other expressions derive values.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.vortex.api.Expression
Expression.Visitor<T>
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription<T> T
accept
(Expression.Visitor<T> visitor) Accepts a visitor and dispatches to the appropriate visit method based on the expression type.children()
Returns the children of this expression.id()
The globally unique identifier for this type of expression.Optional<byte[]>
metadata()
Returns the serialized metadata for this expression, or empty if serialization is not supported.static Root
parse
(byte[] _metadata, List<Expression> children) Parses a Root expression from serialized metadata and child expressions.toString()
-
Field Details
-
INSTANCE
The singleton instance of the Root expression. Since Root expressions have no state or parameters, a single instance is shared.
-
-
Method Details
-
parse
Parses a Root expression from serialized metadata and child expressions. This method is used during deserialization of Vortex expressions.- Parameters:
_metadata
- the serialized metadata (ignored for Root expressions)children
- the child expressions, must be empty for Root expressions- Returns:
- the singleton Root instance
- Throws:
RuntimeException
- if any children are provided
-
id
Description copied from interface:Expression
The globally unique identifier for this type of expression.- Specified by:
id
in interfaceExpression
-
children
Description copied from interface:Expression
Returns the children of this expression.- Specified by:
children
in interfaceExpression
-
metadata
Description copied from interface:Expression
Returns the serialized metadata for this expression, or empty if serialization is not supported.- Specified by:
metadata
in interfaceExpression
-
toString
-
accept
Description copied from interface:Expression
Accepts a visitor and dispatches to the appropriate visit method based on the expression type. This method implements the visitor pattern, allowing different operations to be performed on expressions without modifying the expression classes themselves.- Specified by:
accept
in interfaceExpression
- Type Parameters:
T
- the return type of the visitor- Parameters:
visitor
- the visitor to accept- Returns:
- the result of the visitor's operation on this expression
-