Record Class Select

java.lang.Object
java.lang.Record
com.libdbm.cel.ast.Select
Record Components:
operand - the expression whose field is being selected
field - the field name to select
isTest - whether this represents a presence test rather than a value fetch
All Implemented Interfaces:
Expression

public record Select(Expression operand, String field, boolean isTest) extends Record implements Expression
Represents field selection in CEL expressions.

Selection can be used for field access (operand.field). When isTest is true, the expression is a presence test (has(operand.field)).

  • Constructor Details

    • Select

      public Select(Expression operand, String field)
      Constructs a field selection expression.

      Represents a field access operation (operand.field) in CEL expressions. When isTest is true, the expression represents a presence test (has(operand.field)) rather than a value fetch.

      Parameters:
      operand - the expression whose field is being selected
      field - the field name to select
    • Select

      public Select(Expression operand, String field, boolean isTest)
      Creates an instance of a Select record class.
      Parameters:
      operand - the value for the operand record component
      field - the value for the field record component
      isTest - the value for the isTest record component
  • Method Details

    • accept

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

      This method implements the visitor pattern by calling the visitSelect method on the provided visitor, passing this Select expression instance to it.

      Specified by:
      accept in interface Expression
      Type Parameters:
      T - the return type of the visitor's visit operations
      Parameters:
      visitor - the visitor that will process this select expression
      Returns:
      the result of the visitor's visitSelect method
    • 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.
    • operand

      public Expression operand()
      Returns the value of the operand record component.
      Returns:
      the value of the operand record component
    • field

      public String field()
      Returns the value of the field record component.
      Returns:
      the value of the field record component
    • isTest

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