Record Class Call

java.lang.Object
java.lang.Record
com.libdbm.cel.ast.Call
Record Components:
target - the optional receiver expression; may be null for global function calls
function - the function or method name
args - the argument expressions in call order
isMacro - whether this call represents a macro invocation that should be expanded during parsing rather than evaluated at runtime
All Implemented Interfaces:
Expression

public record Call(Expression target, String function, List<Expression> args, boolean isMacro) extends Record implements Expression
Represents a function call or method invocation in CEL expressions.

Calls can be in either function style (fn(arg1, arg2)) or receiver/method style (receiver.fn(arg1, arg2)).

  • Constructor Details

    • Call

      public Call(Expression target, String function, List<Expression> args)
      Constructs a function call or method invocation expression.

      This constructor creates a call expression with the specified target, function name, and arguments, marking it as a regular function call rather than a macro invocation.

      Parameters:
      target - the optional receiver expression; may be null for global function calls
      function - the function or method name
      args - the argument expressions in call order
    • Call

      public Call(Expression target, String function, List<Expression> args, boolean isMacro)
      Creates an instance of a Call record class.
      Parameters:
      target - the value for the target record component
      function - the value for the function record component
      args - the value for the args record component
      isMacro - the value for the isMacro record component
  • Method Details

    • accept

      public <T> T accept(Expression.Visitor<T> visitor)
      Accepts a visitor and dispatches the visit operation to the appropriate visitor method.

      This method implements the visitor pattern for expression traversal, allowing external visitors to process call expressions in the abstract syntax tree.

      Specified by:
      accept in interface Expression
      Type Parameters:
      T - the return type of the visitor's visit operations
      Parameters:
      visitor - the visitor instance that will process this call expression
      Returns:
      the result of the visitor's visitCall method, type T
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • target

      public Expression target()
      Returns the value of the target record component.
      Returns:
      the value of the target record component
    • function

      public String function()
      Returns the value of the function record component.
      Returns:
      the value of the function record component
    • args

      public List<Expression> args()
      Returns the value of the args record component.
      Returns:
      the value of the args record component
    • isMacro

      public boolean isMacro()
      Returns the value of the isMacro record component.
      Returns:
      the value of the isMacro record component