Class ImmutableEnumArg

java.lang.Object
io.substrait.expression.ImmutableEnumArg
All Implemented Interfaces:
EnumArg, FunctionArg

public final class ImmutableEnumArg extends Object implements EnumArg
Immutable implementation of EnumArg.

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

  • Method Details

    • value

      public Optional<String> value()
      Specified by:
      value in interface EnumArg
      Returns:
      The value of the value attribute
    • withValue

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

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

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

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

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

      public static ImmutableEnumArg.Builder builder()
      Creates a builder for ImmutableEnumArg.
       ImmutableEnumArg.builder()
          .value(Optional<String>) // optional value
          .build();
       
      Returns:
      A new ImmutableEnumArg builder