Class ImmutableColumnMeta

java.lang.Object
org.nuiton.db.meta.ImmutableColumnMeta
All Implemented Interfaces:
ColumnMeta

@Generated(from="ColumnMeta", generator="Immutables") @ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableColumnMeta extends Object implements ColumnMeta
Immutable implementation of ColumnMeta.

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

  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface ColumnMeta
      Returns:
      The value of the name attribute
    • getType

      public String getType()
      Specified by:
      getType in interface ColumnMeta
      Returns:
      The value of the type attribute
    • getCustomType

      public Optional<CustomTypeMeta> getCustomType()
      Specified by:
      getCustomType in interface ColumnMeta
      Returns:
      The value of the customType attribute
    • getLength

      public Optional<Integer> getLength()
      Specified by:
      getLength in interface ColumnMeta
      Returns:
      The value of the length attribute
    • getNullable

      public boolean getNullable()
      Specified by:
      getNullable in interface ColumnMeta
      Returns:
      The value of the nullable attribute
    • getComment

      public Optional<String> getComment()
      Specified by:
      getComment in interface ColumnMeta
      Returns:
      The value of the comment attribute
    • isPrimaryKey

      public boolean isPrimaryKey()
      Specified by:
      isPrimaryKey in interface ColumnMeta
      Returns:
      The value of the isPrimaryKey attribute
    • isUnique

      public boolean isUnique()
      Specified by:
      isUnique in interface ColumnMeta
      Returns:
      The value of the isUnique attribute
    • isForeignKey

      public boolean isForeignKey()
      Specified by:
      isForeignKey in interface ColumnMeta
      Returns:
      The value of the isForeignKey attribute
    • getForeignKeyColumns

      public com.google.common.collect.ImmutableSet<String> getForeignKeyColumns()
      Specified by:
      getForeignKeyColumns in interface ColumnMeta
      Returns:
      The value of the foreignKeyColumns attribute
    • getPossibleValues

      public Optional<Map<String,String>> getPossibleValues()
      Specified by:
      getPossibleValues in interface ColumnMeta
      Returns:
      The value of the possibleValues attribute
    • withName

      public final ImmutableColumnMeta 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
    • withType

      public final ImmutableColumnMeta withType(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
      Returns:
      A modified copy or the this object
    • withCustomType

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

      public final ImmutableColumnMeta withCustomType(Optional<? extends CustomTypeMeta> optional)
      Copy the current immutable object by setting an optional value for the customType attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for customType
      Returns:
      A modified copy or this if not changed
    • withLength

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

      public final ImmutableColumnMeta withLength(Optional<Integer> optional)
      Copy the current immutable object by setting an optional value for the length 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 length
      Returns:
      A modified copy or this if not changed
    • withNullable

      public final ImmutableColumnMeta 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
    • withComment

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

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

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

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

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

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

      public final ImmutableColumnMeta withForeignKeyColumns(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of foreignKeyColumns. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of foreignKeyColumns elements to set
      Returns:
      A modified copy or this if not changed
    • withPossibleValues

      public final ImmutableColumnMeta withPossibleValues(Map<String,String> value)
      Copy the current immutable object by setting a present value for the optional possibleValues attribute.
      Parameters:
      value - The value for possibleValues
      Returns:
      A modified copy or this if not changed
    • withPossibleValues

      public final ImmutableColumnMeta withPossibleValues(Optional<? extends Map<String,String>> optional)
      Copy the current immutable object by setting an optional value for the possibleValues attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for possibleValues
      Returns:
      A modified copy or this if not changed
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableColumnMeta 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: name, type, customType, length, nullable, comment, isPrimaryKey, isUnique, isForeignKey, foreignKeyColumns, possibleValues.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

      public static ImmutableColumnMeta.Builder builder()
      Creates a builder for ImmutableColumnMeta.
      ImmutableColumnMeta.builder()
         .name(String) // required name
         .type(String) // required type
         .customType(Optional<org.nuiton.db.meta.CustomTypeMeta>) // optional customType
         .length(Optional<Integer>) // optional length
         .nullable(boolean) // required nullable
         .comment(Optional<String>) // optional comment
         .isPrimaryKey(boolean) // required isPrimaryKey
         .isUnique(boolean) // required isUnique
         .isForeignKey(boolean) // required isForeignKey
         .addForeignKeyColumns|addAllForeignKeyColumns(String) // foreignKeyColumns elements
         .possibleValues(Optional<Map<String, String>>) // optional possibleValues
         .build();
      
      Returns:
      A new ImmutableColumnMeta builder