Class ImmutableTableMeta

java.lang.Object
org.nuiton.db.meta.ImmutableTableMeta
All Implemented Interfaces:
TableMeta

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

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

  • Method Details

    • getName

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

      public boolean isView()
      Specified by:
      isView in interface TableMeta
      Returns:
      The value of the isView attribute
    • getColumns

      public com.google.common.collect.ImmutableList<ColumnMeta> getColumns()
      Specified by:
      getColumns in interface TableMeta
      Returns:
      The value of the columns attribute
    • getCount

      public Optional<Long> getCount()
      Specified by:
      getCount in interface TableMeta
      Returns:
      The value of the count attribute
    • getComment

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

      public final ImmutableTableMeta 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
    • withIsView

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

      public final ImmutableTableMeta withColumns(ColumnMeta... elements)
      Copy the current immutable object with elements that replace the content of columns.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withColumns

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

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

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

      public final ImmutableTableMeta 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 ImmutableTableMeta 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
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableTableMeta 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, isView, columns, count, comment.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

      public static ImmutableTableMeta.Builder builder()
      Creates a builder for ImmutableTableMeta.
      ImmutableTableMeta.builder()
         .name(String) // required name
         .isView(boolean) // required isView
         .addColumns|addAllColumns(org.nuiton.db.meta.ColumnMeta) // columns elements
         .count(Optional<Long>) // optional count
         .comment(Optional<String>) // optional comment
         .build();
      
      Returns:
      A new ImmutableTableMeta builder