Class ImmutableSimpleExtension.Option

java.lang.Object
io.substrait.extension.ImmutableSimpleExtension.Option
All Implemented Interfaces:
SimpleExtension.Option
Enclosing class:
ImmutableSimpleExtension

public static final class ImmutableSimpleExtension.Option extends Object implements SimpleExtension.Option
Immutable implementation of SimpleExtension.Option.

Use the builder to create immutable instances: ImmutableSimpleExtension.Option.builder().

  • Method Details

    • getDescription

      public Optional<String> getDescription()
      Specified by:
      getDescription in interface SimpleExtension.Option
      Returns:
      The value of the description attribute
    • getValues

      public List<String> getValues()
      Specified by:
      getValues in interface SimpleExtension.Option
      Returns:
      The value of the values attribute
    • withDescription

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

      public final ImmutableSimpleExtension.Option withDescription(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the description 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 description
      Returns:
      A modified copy or this if not changed
    • withValues

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

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

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

      Creates an immutable copy of a SimpleExtension.Option 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 Option instance
    • builder

      public static ImmutableSimpleExtension.Option.Builder builder()
      Creates a builder for Option.
       ImmutableSimpleExtension.Option.builder()
          .description(Optional<String>) // optional description
          .addValues|addAllValues(String) // values elements
          .build();
       
      Returns:
      A new Option builder