Class ForeignKey
java.lang.Object
io.github.mfvanek.pg.model.constraint.ForeignKey
- All Implemented Interfaces:
DbObject,TableNameAware
A representation of foreign key in a database.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfinal booleanGets columns of foreign key constraint.Gets the name of foreign key constraint.final StringgetName()Gets database object name.Gets table name.final inthashCode()static ForeignKeyConstructs aForeignKeyobject with given columns.static ForeignKeyConstructs aForeignKeyobject with givenColumn.static ForeignKeyofNotNullColumn(String tableName, String constraintName, String columnName) Constructs aForeignKeyobject with not null column.static ForeignKeyofNullableColumn(String tableName, String constraintName, String columnName) Constructs aForeignKeyobject with nullable column.toString()
-
Method Details
-
getName
Gets database object name. -
getTableName
Gets table name.- Specified by:
getTableNamein interfaceTableNameAware- Returns:
- table name
-
getConstraintName
Gets the name of foreign key constraint.- Returns:
- the name of foreign key
-
getColumnsInConstraint
Gets columns of foreign key constraint.- Returns:
- columns of foreign key constraint
- See Also:
-
equals
-
hashCode
public final int hashCode() -
toString
-
of
@Nonnull public static ForeignKey of(@Nonnull String tableName, @Nonnull String constraintName, @Nonnull List<Column> columnsInConstraint) Constructs aForeignKeyobject with given columns.- Parameters:
tableName- table name; should be non-blank.constraintName- constraint name; should be non-blank.columnsInConstraint- list of columns that are included in constraint; should be non-empty.- Returns:
ForeignKey
-
ofColumn
@Nonnull public static ForeignKey ofColumn(@Nonnull String tableName, @Nonnull String constraintName, @Nonnull Column column) Constructs aForeignKeyobject with givenColumn.- Parameters:
tableName- table name; should be non-blank.constraintName- constraint name; should be non-blank.column- column that is included in constraint.- Returns:
ForeignKey
-
ofNotNullColumn
@Nonnull public static ForeignKey ofNotNullColumn(@Nonnull String tableName, @Nonnull String constraintName, @Nonnull String columnName) Constructs aForeignKeyobject with not null column.- Parameters:
tableName- table name; should be non-blank.constraintName- constraint name; should be non-blank.columnName- name of column that is included in constraint; should be non-blank.- Returns:
ForeignKey
-
ofNullableColumn
@Nonnull public static ForeignKey ofNullableColumn(@Nonnull String tableName, @Nonnull String constraintName, @Nonnull String columnName) Constructs aForeignKeyobject with nullable column.- Parameters:
tableName- table name; should be non-blank.constraintName- constraint name; should be non-blank.columnName- name of column that is included in constraint; should be non-blank.- Returns:
ForeignKey
-