Class ImmutableExpression.Switch

java.lang.Object
io.substrait.expression.Expression.Switch
io.substrait.expression.ImmutableExpression.Switch
All Implemented Interfaces:
Expression, FunctionArg
Enclosing class:
ImmutableExpression

public static final class ImmutableExpression.Switch extends Expression.Switch
Immutable implementation of Expression.Switch.

Use the builder to create immutable instances: ImmutableExpression.Switch.builder().

  • Method Details

    • match

      public Expression match()
      Specified by:
      match in class Expression.Switch
      Returns:
      The value of the match attribute
    • switchClauses

      public List<Expression.SwitchClause> switchClauses()
      Specified by:
      switchClauses in class Expression.Switch
      Returns:
      The value of the switchClauses attribute
    • defaultClause

      public Expression defaultClause()
      Specified by:
      defaultClause in class Expression.Switch
      Returns:
      The value of the defaultClause attribute
    • withMatch

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

      public final ImmutableExpression.Switch withSwitchClauses(Expression.SwitchClause... elements)
      Copy the current immutable object with elements that replace the content of switchClauses.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withSwitchClauses

      public final ImmutableExpression.Switch withSwitchClauses(Iterable<? extends Expression.SwitchClause> elements)
      Copy the current immutable object with elements that replace the content of switchClauses. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of switchClauses elements to set
      Returns:
      A modified copy or this if not changed
    • withDefaultClause

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

      public boolean equals(Object another)
      This instance is equal to all instances of Switch 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: match, switchClauses, defaultClause.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableExpression.Switch copyOf(Expression.Switch instance)
      Creates an immutable copy of a Expression.Switch 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 Switch instance
    • builder

      public static ImmutableExpression.Switch.Builder builder()
      Creates a builder for Switch.
       ImmutableExpression.Switch.builder()
          .match(io.substrait.expression.Expression) // required match
          .addSwitchClauses|addAllSwitchClauses(io.substrait.expression.Expression.SwitchClause) // switchClauses elements
          .defaultClause(io.substrait.expression.Expression) // required defaultClause
          .build();
       
      Returns:
      A new Switch builder