Class ImmutableExpression.StructLiteral

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

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

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

  • Method Details

    • nullable

      public boolean nullable()
      Returns:
      The value of the nullable attribute
    • fields

      public List<Expression.Literal> fields()
      Specified by:
      fields in class Expression.StructLiteral
      Returns:
      The value of the fields attribute
    • withNullable

      public final ImmutableExpression.StructLiteral withNullable(boolean value)
      Copy the current immutable object by setting a value for the nullable attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for nullable
      Returns:
      A modified copy or the this object
    • withFields

      public final ImmutableExpression.StructLiteral withFields(Expression.Literal... elements)
      Copy the current immutable object with elements that replace the content of fields.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withFields

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

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

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

      Creates an immutable copy of a Expression.StructLiteral 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 StructLiteral instance
    • builder

      Creates a builder for StructLiteral.
       ImmutableExpression.StructLiteral.builder()
          .nullable(boolean) // optional nullable
          .addFields|addAllFields(io.substrait.expression.Expression.Literal) // fields elements
          .build();
       
      Returns:
      A new StructLiteral builder