Class TableWithBloat

java.lang.Object
io.github.mfvanek.pg.model.table.TableWithBloat
All Implemented Interfaces:
BloatAware, DbObject, TableBloatAware, TableNameAware, TableSizeAware, Comparable<TableWithBloat>

@Immutable public class TableWithBloat extends Object implements TableBloatAware, Comparable<TableWithBloat>
Represents database table with information about bloat.
  • Field Details

    • table

      protected final Table table
  • Method Details

    • getBloatSizeInBytes

      public long getBloatSizeInBytes()
      Gets bloat amount in bytes.
      Specified by:
      getBloatSizeInBytes in interface BloatAware
      Returns:
      bloat amount
    • getBloatPercentage

      public int getBloatPercentage()
      Gets bloat percentage (in the range from 0 to 100 inclusive).
      Specified by:
      getBloatPercentage in interface BloatAware
      Returns:
      bloat percentage
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object
    • equals

      public final boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(@Nonnull TableWithBloat other)
      Specified by:
      compareTo in interface Comparable<TableWithBloat>
    • of

      public static TableWithBloat of(@Nonnull String tableName, long tableSizeInBytes, long bloatSizeInBytes, int bloatPercentage)
      Constructs a TableWithBloat object.
      Parameters:
      tableName - table name; should be non-blank.
      tableSizeInBytes - table size in bytes; should be positive or zero.
      bloatSizeInBytes - bloat amount in bytes; should be positive or zero.
      bloatPercentage - bloat percentage in the range from 0 to 100 inclusive.
      Returns:
      TableWithBloat
    • of

      public static TableWithBloat of(@Nonnull Table table, long bloatSizeInBytes, int bloatPercentage)
      Constructs a TableWithBloat object.
      Parameters:
      table - table; should be non-null.
      bloatSizeInBytes - bloat amount in bytes; should be positive or zero.
      bloatPercentage - bloat percentage in the range from 0 to 100 inclusive.
      Returns:
      TableWithBloat
      Since:
      0.7.0
    • getName

      @Nonnull public final String getName()
      Gets database object name.
      Specified by:
      getName in interface DbObject
      Returns:
      database object name
    • getTableName

      @Nonnull public final String getTableName()
      Gets table name.
      Specified by:
      getTableName in interface TableNameAware
      Returns:
      table name
    • getTableSizeInBytes

      public final long getTableSizeInBytes()
      Gets table size in bytes.
      Specified by:
      getTableSizeInBytes in interface TableSizeAware
      Returns:
      table size in bytes