Class ImmutableVersion

java.lang.Object
io.substrait.plan.Plan.Version
io.substrait.plan.ImmutableVersion

public final class ImmutableVersion extends Plan.Version
Immutable implementation of Plan.Version.

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

  • Method Details

    • getMajor

      public int getMajor()
      Specified by:
      getMajor in class Plan.Version
      Returns:
      The value of the major attribute
    • getMinor

      public int getMinor()
      Specified by:
      getMinor in class Plan.Version
      Returns:
      The value of the minor attribute
    • getPatch

      public int getPatch()
      Specified by:
      getPatch in class Plan.Version
      Returns:
      The value of the patch attribute
    • getGitHash

      public Optional<String> getGitHash()
      Specified by:
      getGitHash in class Plan.Version
      Returns:
      The value of the gitHash attribute
    • getProducer

      public Optional<String> getProducer()
      Specified by:
      getProducer in class Plan.Version
      Returns:
      The value of the producer attribute
    • withMajor

      public final ImmutableVersion withMajor(int value)
      Copy the current immutable object by setting a value for the major attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for major
      Returns:
      A modified copy or the this object
    • withMinor

      public final ImmutableVersion withMinor(int value)
      Copy the current immutable object by setting a value for the minor attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for minor
      Returns:
      A modified copy or the this object
    • withPatch

      public final ImmutableVersion withPatch(int value)
      Copy the current immutable object by setting a value for the patch attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for patch
      Returns:
      A modified copy or the this object
    • withGitHash

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

      public final ImmutableVersion withGitHash(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the gitHash 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 gitHash
      Returns:
      A modified copy or this if not changed
    • withProducer

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

      public final ImmutableVersion withProducer(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the producer 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 producer
      Returns:
      A modified copy or this if not changed
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableVersion 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: major, minor, patch, gitHash, producer.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

      public static ImmutableVersion.Builder builder()
      Creates a builder for ImmutableVersion.
       ImmutableVersion.builder()
          .major(int) // required major
          .minor(int) // required minor
          .patch(int) // required patch
          .gitHash(Optional<String>) // optional gitHash
          .producer(Optional<String>) // optional producer
          .build();
       
      Returns:
      A new ImmutableVersion builder