Class ImmutablePlan

java.lang.Object
io.substrait.plan.Plan
io.substrait.plan.ImmutablePlan

public final class ImmutablePlan extends Plan
Immutable implementation of Plan.

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

  • Method Details

    • getVersion

      public Plan.Version getVersion()
      Overrides:
      getVersion in class Plan
      Returns:
      The value of the version attribute
    • getRoots

      public List<Plan.Root> getRoots()
      Specified by:
      getRoots in class Plan
      Returns:
      The value of the roots attribute
    • getExpectedTypeUrls

      public List<String> getExpectedTypeUrls()
      Specified by:
      getExpectedTypeUrls in class Plan
      Returns:
      The value of the expectedTypeUrls attribute
    • getAdvancedExtension

      public Optional<AdvancedExtension> getAdvancedExtension()
      Specified by:
      getAdvancedExtension in class Plan
      Returns:
      The value of the advancedExtension attribute
    • withVersion

      public final ImmutablePlan withVersion(Plan.Version value)
      Copy the current immutable object by setting a value for the version attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for version
      Returns:
      A modified copy or the this object
    • withRoots

      public final ImmutablePlan withRoots(Plan.Root... elements)
      Copy the current immutable object with elements that replace the content of roots.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withRoots

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

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

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

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

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

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

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

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

      public static ImmutablePlan.Builder builder()
      Creates a builder for ImmutablePlan.
       ImmutablePlan.builder()
          .version(io.substrait.plan.Plan.Version) // optional version
          .addRoots|addAllRoots(io.substrait.plan.Plan.Root) // roots elements
          .addExpectedTypeUrls|addAllExpectedTypeUrls(String) // expectedTypeUrls elements
          .advancedExtension(Optional<io.substrait.extension.AdvancedExtension>) // optional advancedExtension
          .build();
       
      Returns:
      A new ImmutablePlan builder