Class Constraint

    • Constructor Detail

      • Constraint

        public Constraint()
    • Method Detail

      • getName

        public String getName()
      • setName

        public void setName​(String name)
      • generateName

        public static String generateName​(String prefix,
                                          Table table,
                                          Column... columns)
        If a constraint is not explicitly named, this is called to generate a unique hash using the table and column names. Static so the name can be generated prior to creating the Constraint. They're cached, keyed by name, in multiple locations.
        Returns:
        String The generated name
      • hashedName

        public static String hashedName​(String s)
        Hash a constraint name using MD5. Convert the MD5 digest to base 35 (full alphanumeric), guaranteeing that the length of the name will always be smaller than the 30 character identifier restriction enforced by a few dialects.
        Parameters:
        s - The name to be hashed.
        Returns:
        String The hashed name.
      • addColumn

        public void addColumn​(Column column)
      • addColumns

        public void addColumns​(Iterator columnIterator)
      • containsColumn

        public boolean containsColumn​(Column column)
        Returns:
        true if this constraint already contains a column with same name.
      • getColumnSpan

        public int getColumnSpan()
      • getColumn

        public Column getColumn​(int i)
      • getTable

        public Table getTable()
      • setTable

        public void setTable​(Table table)
      • isGenerated

        public boolean isGenerated​(Dialect dialect)
      • generatedConstraintNamePrefix

        public abstract String generatedConstraintNamePrefix()
        Returns:
        String The prefix to use in generated constraint names. Examples: "UK_", "FK_", and "PK_".