Class Root

java.lang.Object
dev.vortex.api.expressions.Root
All Implemented Interfaces:
Expression

public final class Root extends Object implements 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.
  • Field Details

    • INSTANCE

      public static final Root INSTANCE
      The singleton instance of the Root expression. Since Root expressions have no state or parameters, a single instance is shared.
  • Method Details

    • parse

      public static Root parse(byte[] _metadata, List<Expression> children)
      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

      public String id()
      Description copied from interface: Expression
      The globally unique identifier for this type of expression.
      Specified by:
      id in interface Expression
    • children

      public List<Expression> children()
      Description copied from interface: Expression
      Returns the children of this expression.
      Specified by:
      children in interface Expression
    • metadata

      public Optional<byte[]> metadata()
      Description copied from interface: Expression
      Returns the serialized metadata for this expression, or empty if serialization is not supported.
      Specified by:
      metadata in interface Expression
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • accept

      public <T> T accept(Expression.Visitor<T> visitor)
      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 interface Expression
      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