Class ImmutableType.UserDefined

java.lang.Object
io.substrait.type.Type.UserDefined
io.substrait.type.ImmutableType.UserDefined
All Implemented Interfaces:
FunctionArg, NullableType, ParameterizedType, TypeExpression, Type
Enclosing class:
ImmutableType

public static final class ImmutableType.UserDefined extends Type.UserDefined
Immutable implementation of Type.UserDefined.

Use the builder to create immutable instances: ImmutableType.UserDefined.builder().

  • Method Details

    • nullable

      public boolean nullable()
      Returns:
      The value of the nullable attribute
    • urn

      public String urn()
      Specified by:
      urn in class Type.UserDefined
      Returns:
      The value of the urn attribute
    • name

      public String name()
      Specified by:
      name in class Type.UserDefined
      Returns:
      The value of the name attribute
    • typeParameters

      public List<Type.Parameter> typeParameters()
      Returns the type parameters for this user-defined type.

      Type parameters are used to represent parameterized/generic types, such as vector<i32>.

      Overrides:
      typeParameters in class Type.UserDefined
      Returns:
      a list of type parameters, or an empty list if this type is not parameterized
    • withNullable

      public final ImmutableType.UserDefined withNullable(boolean value)
      Copy the current immutable object by setting a value for the nullable attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for nullable
      Returns:
      A modified copy or the this object
    • withUrn

      public final ImmutableType.UserDefined withUrn(String value)
      Copy the current immutable object by setting a value for the urn attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for urn
      Returns:
      A modified copy or the this object
    • withName

      public final ImmutableType.UserDefined withName(String value)
      Copy the current immutable object by setting a value for the name attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for name
      Returns:
      A modified copy or the this object
    • withTypeParameters

      public final ImmutableType.UserDefined withTypeParameters(Type.Parameter... elements)
      Copy the current immutable object with elements that replace the content of typeParameters.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withTypeParameters

      public final ImmutableType.UserDefined withTypeParameters(Iterable<? extends Type.Parameter> elements)
      Copy the current immutable object with elements that replace the content of typeParameters. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of typeParameters 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 UserDefined 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: nullable, urn, name, typeParameters.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableType.UserDefined copyOf(Type.UserDefined instance)
      Creates an immutable copy of a Type.UserDefined 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 UserDefined instance
    • builder

      public static ImmutableType.UserDefined.Builder builder()
      Creates a builder for UserDefined.
       ImmutableType.UserDefined.builder()
          .nullable(boolean) // required nullable
          .urn(String) // required urn
          .name(String) // required name
          .addTypeParameters|addAllTypeParameters(io.substrait.type.Type.Parameter) // typeParameters elements
          .build();
       
      Returns:
      A new UserDefined builder