Class ImmutableAdvancedExtension<O extends AdvancedExtension.Optimization,E extends AdvancedExtension.Enhancement>

java.lang.Object
io.substrait.extension.AdvancedExtension<O,E>
io.substrait.extension.ImmutableAdvancedExtension<O,E>

public final class ImmutableAdvancedExtension<O extends AdvancedExtension.Optimization,E extends AdvancedExtension.Enhancement> extends AdvancedExtension<O,E>
Immutable implementation of AdvancedExtension.

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

  • Method Details

    • getOptimizations

      public List<O> getOptimizations()
      Returns the list of optimizations associated with this extension.
      Specified by:
      getOptimizations in class AdvancedExtension<O extends AdvancedExtension.Optimization,E extends AdvancedExtension.Enhancement>
      Returns:
      list of optimizations
    • getEnhancement

      public Optional<E> getEnhancement()
      Returns the optional enhancement associated with this extension.
      Specified by:
      getEnhancement in class AdvancedExtension<O extends AdvancedExtension.Optimization,E extends AdvancedExtension.Enhancement>
      Returns:
      optional enhancement
    • withOptimizations

      @SafeVarargs public final ImmutableAdvancedExtension<O,E> withOptimizations(O... elements)
      Copy the current immutable object with elements that replace the content of optimizations.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withOptimizations

      public final ImmutableAdvancedExtension<O,E> withOptimizations(Iterable<? extends O> elements)
      Copy the current immutable object with elements that replace the content of optimizations. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of optimizations elements to set
      Returns:
      A modified copy or this if not changed
    • withEnhancement

      public final ImmutableAdvancedExtension<O,E> withEnhancement(E value)
      Copy the current immutable object by setting a present value for the optional enhancement attribute.
      Parameters:
      value - The value for enhancement
      Returns:
      A modified copy or this if not changed
    • withEnhancement

      public final ImmutableAdvancedExtension<O,E> withEnhancement(Optional<? extends E> optional)
      Copy the current immutable object by setting an optional value for the enhancement attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for enhancement
      Returns:
      A modified copy or this if not changed
    • equals

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

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

      public static <O extends AdvancedExtension.Optimization, E extends AdvancedExtension.Enhancement> ImmutableAdvancedExtension<O,E> copyOf(AdvancedExtension<O,E> instance)
      Creates an immutable copy of a AdvancedExtension value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Type Parameters:
      O - generic parameter O
      E - generic parameter E
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable AdvancedExtension instance
    • builder

      Creates a builder for ImmutableAdvancedExtension.
       ImmutableAdvancedExtension.<O, E>builder()
          .addOptimizations|addAllOptimizations(O) // optimizations elements
          .enhancement(Optional<E>) // optional enhancement
          .build();
       
      Type Parameters:
      O - generic parameter O
      E - generic parameter E
      Returns:
      A new ImmutableAdvancedExtension builder