Class ImmutableMapKey

java.lang.Object
io.substrait.expression.FieldReference.MapKey
io.substrait.expression.ImmutableMapKey
All Implemented Interfaces:
FieldReference.ReferenceSegment

public final class ImmutableMapKey extends FieldReference.MapKey
Immutable implementation of FieldReference.MapKey.

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

  • Method Details

    • key

      public Expression.Literal key()
      Specified by:
      key in class FieldReference.MapKey
      Returns:
      The value of the key attribute
    • withKey

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

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

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

      public static ImmutableMapKey copyOf(FieldReference.MapKey instance)
      Creates an immutable copy of a FieldReference.MapKey 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 MapKey instance
    • builder

      public static ImmutableMapKey.Builder builder()
      Creates a builder for ImmutableMapKey.
       ImmutableMapKey.builder()
          .key(io.substrait.expression.Expression.Literal) // required key
          .build();
       
      Returns:
      A new ImmutableMapKey builder