Class ImmutableNamedStruct

java.lang.Object
io.substrait.type.ImmutableNamedStruct
All Implemented Interfaces:
NamedStruct

public final class ImmutableNamedStruct extends Object implements NamedStruct
Immutable implementation of NamedStruct.

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

  • Method Details

    • struct

      public Type.Struct struct()
      Specified by:
      struct in interface NamedStruct
      Returns:
      The value of the struct attribute
    • names

      public List<String> names()
      Specified by:
      names in interface NamedStruct
      Returns:
      The value of the names attribute
    • withStruct

      public final ImmutableNamedStruct withStruct(Type.Struct value)
      Copy the current immutable object by setting a value for the struct attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for struct
      Returns:
      A modified copy or the this object
    • withNames

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

      public final ImmutableNamedStruct withNames(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of names. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of names 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 ImmutableNamedStruct 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: struct, names.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableNamedStruct copyOf(NamedStruct instance)
      Creates an immutable copy of a NamedStruct 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 NamedStruct instance
    • builder

      public static ImmutableNamedStruct.Builder builder()
      Creates a builder for ImmutableNamedStruct.
       ImmutableNamedStruct.builder()
          .struct(io.substrait.type.Type.Struct) // required struct
          .addNames|addAllNames(String) // names elements
          .build();
       
      Returns:
      A new ImmutableNamedStruct builder