Skip to content

Commit

Permalink
Final model classes
Browse files Browse the repository at this point in the history
  • Loading branch information
mfvanek committed Nov 23, 2024
1 parent b7701b8 commit ca218fe
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @since 0.13.1
*/
@Immutable
public class DuplicatedForeignKeys implements DbObject, TableNameAware, ConstraintsAware {
public final class DuplicatedForeignKeys implements DbObject, TableNameAware, ConstraintsAware {

private final List<ForeignKey> foreignKeys;
private final List<String> foreignKeysNames;
Expand All @@ -49,7 +49,7 @@ private DuplicatedForeignKeys(@Nonnull final List<ForeignKey> foreignKeys) {
*/
@Nonnull
@Override
public final String getName() {
public String getName() {
return String.join(",", foreignKeysNames);
}

Expand All @@ -58,7 +58,7 @@ public final String getName() {
*/
@Nonnull
@Override
public final PgObjectType getObjectType() {
public PgObjectType getObjectType() {
return PgObjectType.CONSTRAINT;
}

Expand Down Expand Up @@ -95,7 +95,7 @@ public List<Constraint> getConstraints() {
* {@inheritDoc}
*/
@Override
public final boolean equals(final Object other) {
public boolean equals(final Object other) {
if (this == other) {
return true;
}
Expand All @@ -112,7 +112,7 @@ public final boolean equals(final Object other) {
* {@inheritDoc}
*/
@Override
public final int hashCode() {
public int hashCode() {
return Objects.hash(foreignKeys);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @see Constraint
*/
@Immutable
public class ForeignKey extends Constraint {
public final class ForeignKey extends Constraint {

private final List<Column> columnsInConstraint;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@

import java.util.Locale;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.ThreadSafe;

/**
* Represents a context for running maintenance queries.
*
* @author Ivan Vakhrushev
*/
public class PgContext {
@Immutable
@ThreadSafe
public final class PgContext {

/**
* Default bloat percentage threshold.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @since 0.7.0
*/
@Immutable
public class StoredFunction implements DbObject, Comparable<StoredFunction> {
public final class StoredFunction implements DbObject, Comparable<StoredFunction> {

private final String functionName;
private final String functionSignature;
Expand All @@ -41,7 +41,7 @@ private StoredFunction(@Nonnull final String functionName, @Nonnull final String
*/
@Nonnull
@Override
public final String getName() {
public String getName() {
return getFunctionName();
}

Expand All @@ -50,7 +50,7 @@ public final String getName() {
*/
@Nonnull
@Override
public final PgObjectType getObjectType() {
public PgObjectType getObjectType() {
return PgObjectType.FUNCTION;
}

Expand Down Expand Up @@ -88,7 +88,7 @@ public String toString() {
* {@inheritDoc}
*/
@Override
public final boolean equals(final Object other) {
public boolean equals(final Object other) {
if (this == other) {
return true;
}
Expand All @@ -106,7 +106,7 @@ public final boolean equals(final Object other) {
* {@inheritDoc}
*/
@Override
public final int hashCode() {
public int hashCode() {
return Objects.hash(functionName, functionSignature);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @see TableNameAware
*/
@Immutable
public class DuplicatedIndexes implements DbObject, TableNameAware, IndexesAware {
public final class DuplicatedIndexes implements DbObject, TableNameAware, IndexesAware {

private static final Comparator<IndexWithSize> INDEX_WITH_SIZE_COMPARATOR =
Comparator.comparing(IndexWithSize::getTableName)
Expand Down Expand Up @@ -61,7 +61,7 @@ private DuplicatedIndexes(@Nonnull final List<IndexWithSize> duplicatedIndexes)
*/
@Nonnull
@Override
public final String getName() {
public String getName() {
return String.join(",", indexesNames);
}

Expand All @@ -70,7 +70,7 @@ public final String getName() {
*/
@Nonnull
@Override
public final PgObjectType getObjectType() {
public PgObjectType getObjectType() {
return PgObjectType.INDEX;
}

Expand Down Expand Up @@ -124,7 +124,7 @@ public List<String> getIndexNames() {
* {@inheritDoc}
*/
@Override
public final boolean equals(final Object other) {
public boolean equals(final Object other) {
if (this == other) {
return true;
}
Expand All @@ -141,7 +141,7 @@ public final boolean equals(final Object other) {
* {@inheritDoc}
*/
@Override
public final int hashCode() {
public int hashCode() {
return Objects.hash(indexes);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* @author Ivan Vakhrushev
*/
@Immutable
public class IndexWithBloat extends IndexWithSize implements BloatAware {
public final class IndexWithBloat extends IndexWithSize implements BloatAware {

private final long bloatSizeInBytes;
private final double bloatPercentage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @since 0.12.0
*/
@Immutable
public class SequenceState implements DbObject, SequenceNameAware {
public final class SequenceState implements DbObject, SequenceNameAware {

private final String sequenceName;
private final String dataType;
Expand Down Expand Up @@ -84,7 +84,7 @@ public double getRemainingPercentage() {
*/
@Nonnull
@Override
public final String getName() {
public String getName() {
return getSequenceName();
}

Expand All @@ -93,15 +93,15 @@ public final String getName() {
*/
@Nonnull
@Override
public final PgObjectType getObjectType() {
public PgObjectType getObjectType() {
return PgObjectType.SEQUENCE;
}

/**
* {@inheritDoc}
*/
@Override
public final boolean equals(final Object other) {
public boolean equals(final Object other) {
if (this == other) {
return true;
}
Expand All @@ -118,7 +118,7 @@ public final boolean equals(final Object other) {
* {@inheritDoc}
*/
@Override
public final int hashCode() {
public int hashCode() {
return Objects.hash(sequenceName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @author Ivan Vakhrushev
*/
@Immutable
public class Table implements DbObject, TableSizeAware, Comparable<Table> {
public final class Table implements DbObject, TableSizeAware, Comparable<Table> {

private final String tableName;
private final long tableSizeInBytes;
Expand All @@ -39,7 +39,7 @@ private Table(@Nonnull final String tableName, final long tableSizeInBytes) {
*/
@Nonnull
@Override
public final String getName() {
public String getName() {
return getTableName();
}

Expand All @@ -48,7 +48,7 @@ public final String getName() {
*/
@Nonnull
@Override
public final PgObjectType getObjectType() {
public PgObjectType getObjectType() {
return PgObjectType.TABLE;
}

Expand All @@ -75,7 +75,7 @@ public long getTableSizeInBytes() {
* @return string representation of the internal fields of this class
*/
@Nonnull
final String innerToString() {
String innerToString() {
return "tableName='" + tableName + '\'' +
", tableSizeInBytes=" + tableSizeInBytes;
}
Expand All @@ -93,7 +93,7 @@ public String toString() {
* {@inheritDoc}
*/
@Override
public final boolean equals(final Object other) {
public boolean equals(final Object other) {
if (this == other) {
return true;
}
Expand All @@ -110,7 +110,7 @@ public final boolean equals(final Object other) {
* {@inheritDoc}
*/
@Override
public final int hashCode() {
public int hashCode() {
return Objects.hash(tableName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @author Ivan Vakhrushev
*/
@Immutable
public class TableWithBloat extends AbstractTableAware implements BloatAware, Comparable<TableWithBloat> {
public final class TableWithBloat extends AbstractTableAware implements BloatAware, Comparable<TableWithBloat> {

private final long bloatSizeInBytes;
private final double bloatPercentage;
Expand Down Expand Up @@ -68,7 +68,7 @@ public String toString() {
* {@inheritDoc}
*/
@Override
public final boolean equals(final Object other) {
public boolean equals(final Object other) {
if (this == other) {
return true;
}
Expand All @@ -85,7 +85,7 @@ public final boolean equals(final Object other) {
* {@inheritDoc}
*/
@Override
public final int hashCode() {
public int hashCode() {
return Objects.hash(table);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* @author Ivan Vakhrushev
*/
@Immutable
public class TableWithMissingIndex extends AbstractTableAware implements Comparable<TableWithMissingIndex> {
public final class TableWithMissingIndex extends AbstractTableAware implements Comparable<TableWithMissingIndex> {

/**
* The number of sequential scans performed on the table.
Expand Down Expand Up @@ -79,7 +79,7 @@ public String toString() {
* {@inheritDoc}
*/
@Override
public final boolean equals(final Object other) {
public boolean equals(final Object other) {
if (this == other) {
return true;
}
Expand All @@ -96,7 +96,7 @@ public final boolean equals(final Object other) {
* {@inheritDoc}
*/
@Override
public final int hashCode() {
public int hashCode() {
return Objects.hash(table);
}

Expand Down

0 comments on commit ca218fe

Please sign in to comment.