Class Constraint
java.lang.Object
io.github.mfvanek.pg.model.constraint.Constraint
- All Implemented Interfaces:
DbObject,TableNameAware
- Direct Known Subclasses:
ForeignKey
A representation of constraint in a database.
- Since:
- 0.11.0
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstraint(String tableName, String constraintName, ConstraintType constraintType) Constructs aConstraintobject with givenConstraintType. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanGets the name of constraint.Gets type of constraint.final StringgetName()Gets database object name.Gets table name.final inthashCode()static ConstraintofType(String tableName, String constraintName, ConstraintType constraintType) Constructs aConstraintobject with givenConstraintType.toString()
-
Constructor Details
-
Constraint
protected Constraint(@Nonnull String tableName, @Nonnull String constraintName, @Nonnull ConstraintType constraintType) Constructs aConstraintobject with givenConstraintType.- Parameters:
tableName- table name; should be non-blank.constraintName- constraint name; should be non-blank.constraintType- constraint type; should be non-null.
-
-
Method Details
-
getName
Gets database object name. -
getTableName
Gets table name.- Specified by:
getTableNamein interfaceTableNameAware- Returns:
- table name
-
getConstraintName
Gets the name of constraint.- Returns:
- the name of constraint
-
getConstraintType
Gets type of constraint.- Returns:
- type of constraint
- See Also:
-
equals
-
hashCode
public final int hashCode() -
toString
-
ofType
@Nonnull public static Constraint ofType(@Nonnull String tableName, @Nonnull String constraintName, @Nonnull ConstraintType constraintType) Constructs aConstraintobject with givenConstraintType.- Parameters:
tableName- table name; should be non-blank.constraintName- constraint name; should be non-blank.constraintType- constraint type; should be non-null.- Returns:
Constraint
-