Class ImmutableHint

java.lang.Object
io.substrait.hint.Hint
io.substrait.hint.ImmutableHint
All Implemented Interfaces:
HasExtension

public final class ImmutableHint extends Hint
Immutable implementation of Hint.

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

  • Method Details

    • getExtension

      public Optional<AdvancedExtension> getExtension()
      Returns:
      the AdvancedExtension associated directly with the class
    • getAlias

      public Optional<String> getAlias()
      Specified by:
      getAlias in class Hint
      Returns:
      The value of the alias attribute
    • getOutputNames

      public List<String> getOutputNames()
      Specified by:
      getOutputNames in class Hint
      Returns:
      The value of the outputNames attribute
    • getStats

      public Optional<Hint.Stats> getStats()
      Specified by:
      getStats in class Hint
      Returns:
      The value of the stats attribute
    • getRuntimeConstraint

      public Optional<Hint.RuntimeConstraint> getRuntimeConstraint()
      Specified by:
      getRuntimeConstraint in class Hint
      Returns:
      The value of the runtimeConstraint attribute
    • getLoadedComputations

      public List<Hint.LoadedComputation> getLoadedComputations()
      Specified by:
      getLoadedComputations in class Hint
      Returns:
      The value of the loadedComputations attribute
    • getSavedComputations

      public List<Hint.SavedComputation> getSavedComputations()
      Specified by:
      getSavedComputations in class Hint
      Returns:
      The value of the savedComputations attribute
    • withExtension

      public final ImmutableHint withExtension(AdvancedExtension value)
      Copy the current immutable object by setting a present value for the optional extension attribute.
      Parameters:
      value - The value for extension
      Returns:
      A modified copy or this if not changed
    • withExtension

      public final ImmutableHint withExtension(Optional<? extends AdvancedExtension> optional)
      Copy the current immutable object by setting an optional value for the extension 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 extension
      Returns:
      A modified copy or this if not changed
    • withAlias

      public final ImmutableHint withAlias(String value)
      Copy the current immutable object by setting a present value for the optional alias attribute.
      Parameters:
      value - The value for alias
      Returns:
      A modified copy or this if not changed
    • withAlias

      public final ImmutableHint withAlias(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the alias attribute. An equality check is used on inner value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for alias
      Returns:
      A modified copy or this if not changed
    • withOutputNames

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

      public final ImmutableHint withOutputNames(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of outputNames. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of outputNames elements to set
      Returns:
      A modified copy or this if not changed
    • withStats

      public final ImmutableHint withStats(Hint.Stats value)
      Copy the current immutable object by setting a present value for the optional stats attribute.
      Parameters:
      value - The value for stats
      Returns:
      A modified copy or this if not changed
    • withStats

      public final ImmutableHint withStats(Optional<? extends Hint.Stats> optional)
      Copy the current immutable object by setting an optional value for the stats 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 stats
      Returns:
      A modified copy or this if not changed
    • withRuntimeConstraint

      public final ImmutableHint withRuntimeConstraint(Hint.RuntimeConstraint value)
      Copy the current immutable object by setting a present value for the optional runtimeConstraint attribute.
      Parameters:
      value - The value for runtimeConstraint
      Returns:
      A modified copy or this if not changed
    • withRuntimeConstraint

      public final ImmutableHint withRuntimeConstraint(Optional<? extends Hint.RuntimeConstraint> optional)
      Copy the current immutable object by setting an optional value for the runtimeConstraint 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 runtimeConstraint
      Returns:
      A modified copy or this if not changed
    • withLoadedComputations

      public final ImmutableHint withLoadedComputations(Hint.LoadedComputation... elements)
      Copy the current immutable object with elements that replace the content of loadedComputations.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withLoadedComputations

      public final ImmutableHint withLoadedComputations(Iterable<? extends Hint.LoadedComputation> elements)
      Copy the current immutable object with elements that replace the content of loadedComputations. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of loadedComputations elements to set
      Returns:
      A modified copy or this if not changed
    • withSavedComputations

      public final ImmutableHint withSavedComputations(Hint.SavedComputation... elements)
      Copy the current immutable object with elements that replace the content of savedComputations.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withSavedComputations

      public final ImmutableHint withSavedComputations(Iterable<? extends Hint.SavedComputation> elements)
      Copy the current immutable object with elements that replace the content of savedComputations. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of savedComputations 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 ImmutableHint 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: extension, alias, outputNames, stats, runtimeConstraint, loadedComputations, savedComputations.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

      public static ImmutableHint.Builder builder()
      Creates a builder for ImmutableHint.
       ImmutableHint.builder()
          .extension(Optional<io.substrait.extension.AdvancedExtension>) // optional extension
          .alias(Optional<String>) // optional alias
          .addOutputNames|addAllOutputNames(String) // outputNames elements
          .stats(Optional<io.substrait.hint.Hint.Stats>) // optional stats
          .runtimeConstraint(Optional<io.substrait.hint.Hint.RuntimeConstraint>) // optional runtimeConstraint
          .addLoadedComputations|addAllLoadedComputations(io.substrait.hint.Hint.LoadedComputation) // loadedComputations elements
          .addSavedComputations|addAllSavedComputations(io.substrait.hint.Hint.SavedComputation) // savedComputations elements
          .build();
       
      Returns:
      A new ImmutableHint builder