Class ImmutableExpressionReference

java.lang.Object
io.substrait.extendedexpression.ExtendedExpression.ExpressionReference
io.substrait.extendedexpression.ImmutableExpressionReference
All Implemented Interfaces:
ExtendedExpression.ExpressionReferenceBase

public final class ImmutableExpressionReference extends ExtendedExpression.ExpressionReference
Immutable implementation of ExtendedExpression.ExpressionReference.

Use the builder to create immutable instances: ImmutableExpressionReference.builder().

  • Method Details

    • getOutputNames

      public List<String> getOutputNames()
      Returns the output names associated with this reference.
      Returns:
      list of output names
    • getExpression

      public Expression getExpression()
      Returns the referenced expression.
      Specified by:
      getExpression in class ExtendedExpression.ExpressionReference
      Returns:
      the expression
    • withOutputNames

      public final ImmutableExpressionReference withOutputNames(String... elements)
      Copy the current immutable object with elements that replace the content of outputNames.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withOutputNames

      public final ImmutableExpressionReference withOutputNames(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of outputNames. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of outputNames elements to set
      Returns:
      A modified copy or this if not changed
    • withExpression

      public final ImmutableExpressionReference withExpression(Expression value)
      Copy the current immutable object by setting a value for the expression attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for expression
      Returns:
      A modified copy or the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableExpressionReference that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: outputNames, expression.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value ExpressionReference with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      Creates an immutable copy of a ExtendedExpression.ExpressionReference value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable ExpressionReference instance
    • builder

      public static ImmutableExpressionReference.Builder builder()
      Creates a builder for ImmutableExpressionReference.
       ImmutableExpressionReference.builder()
          .addOutputNames|addAllOutputNames(String) // outputNames elements
          .expression(io.substrait.expression.Expression) // required expression
          .build();
       
      Returns:
      A new ImmutableExpressionReference builder