Class ImmutableColumn

java.lang.Object
io.stargate.sgv2.api.common.cql.builder.ImmutableColumn
All Implemented Interfaces:
Column

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableColumn extends Object implements Column
Immutable implementation of Column.

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

  • Method Details

    • name

      public String name()
      Specified by:
      name in interface Column
      Returns:
      The value of the name attribute
    • type

      @Nullable public String type()
      TODO do we ever need a more structured representation?
      Specified by:
      type in interface Column
    • kind

      @Nullable public Column.Kind kind()
      Specified by:
      kind in interface Column
      Returns:
      The value of the kind attribute
    • order

      @Nullable public Column.Order order()
      Specified by:
      order in interface Column
      Returns:
      The value of the order attribute
    • withName

      public final ImmutableColumn 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 of the this object
    • withType

      public final ImmutableColumn withType(@Nullable String value)
      Copy the current immutable object by setting a value for the type attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for type (can be null)
      Returns:
      A modified copy of the this object
    • withKind

      public final ImmutableColumn withKind(@Nullable Column.Kind value)
      Copy the current immutable object by setting a value for the kind attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for kind (can be null)
      Returns:
      A modified copy of the this object
    • withOrder

      public final ImmutableColumn withOrder(@Nullable Column.Order value)
      Copy the current immutable object by setting a value for the order attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for order (can be null)
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableColumn that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Returns a precomputed-on-construction hash code from attributes: name, type, kind, order.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public String cqlName()

      Returns a lazily initialized value of the cqlName attribute. Initialized once and only once and stored for subsequent access with proper synchronization. In case of any exception or error thrown by the lazy value initializer, the result will not be memoised (i.e. remembered) and on next call computation will be attempted again.

      Specified by:
      cqlName in interface Column
      Returns:
      A lazily initialized value of the cqlName attribute
    • copyOf

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

      public static ImmutableColumn.Builder builder()
      Creates a builder for ImmutableColumn.
       ImmutableColumn.builder()
          .name(String) // required name
          .type(String | null) // nullable type
          .kind(io.stargate.sgv2.api.common.cql.builder.Column.Kind | null) // nullable kind
          .order(io.stargate.sgv2.api.common.cql.builder.Column.Order | null) // nullable order
          .build();
       
      Returns:
      A new ImmutableColumn builder