Class TableConstraints


  • public class TableConstraints
    extends Object
    Table Constraints including column constraint
    Since:
    3.3.0
    Author:
    osbornb
    • Constructor Detail

      • TableConstraints

        public TableConstraints()
        Constructor
    • Method Detail

      • addTableConstraint

        public void addTableConstraint​(Constraint constraint)
        Add a table constraint
        Parameters:
        constraint - constraint
      • addTableConstraints

        public void addTableConstraints​(Constraints constraints)
        Add table constraints
        Parameters:
        constraints - constraints
        Since:
        5.0.0
      • getTableConstraints

        public Constraints getTableConstraints()
        Get the table constraints
        Returns:
        table constraints
        Since:
        5.0.0
      • getTableConstraint

        public Constraint getTableConstraint​(int index)
        Get the table constraint at the index
        Parameters:
        index - constraint index
        Returns:
        table constraint
      • numTableConstraints

        public int numTableConstraints()
        Get the number of table constraints
        Returns:
        table constraints count
      • addColumnConstraint

        public void addColumnConstraint​(String columnName,
                                        Constraint constraint)
        Add a column constraint
        Parameters:
        columnName - column name
        constraint - constraint
      • addColumnConstraints

        public void addColumnConstraints​(String columnName,
                                         Collection<Constraint> constraints)
        Add column constraints
        Parameters:
        columnName - column name
        constraints - constraints
      • addColumnConstraints

        public void addColumnConstraints​(ColumnConstraints constraints)
        Add column constraints
        Parameters:
        constraints - constraints
      • addColumnConstraints

        public void addColumnConstraints​(Map<String,​ColumnConstraints> constraints)
        Add column constraints
        Parameters:
        constraints - column constraints
      • addColumnConstraints

        public void addColumnConstraints​(Collection<ColumnConstraints> constraints)
        Add column constraints
        Parameters:
        constraints - column constraints
      • getColumnConstraints

        public Map<String,​ColumnConstraints> getColumnConstraints()
        Get the column constraints
        Returns:
        column constraints
      • getColumnsWithConstraints

        public Set<String> getColumnsWithConstraints()
        Get the column names with constraints
        Returns:
        column names
      • getColumnConstraints

        public ColumnConstraints getColumnConstraints​(String columnName)
        Get the column constraints
        Parameters:
        columnName - column name
        Returns:
        constraints
      • getColumnConstraint

        public Constraint getColumnConstraint​(String columnName,
                                              int index)
        Get the column constraint at the index
        Parameters:
        columnName - column name
        index - constraint index
        Returns:
        column constraint
      • numColumnConstraints

        public int numColumnConstraints​(String columnName)
        Get the number of column constraints for the column name
        Parameters:
        columnName - column name
        Returns:
        column constraints count
      • addConstraints

        public void addConstraints​(TableConstraints constraints)
        Add table constraints
        Parameters:
        constraints - table constraints
      • hasConstraints

        public boolean hasConstraints()
        Check if there are constraints
        Returns:
        true if has constraints
      • hasTableConstraints

        public boolean hasTableConstraints()
        Check if there are table constraints
        Returns:
        true if has table constraints
      • hasColumnConstraints

        public boolean hasColumnConstraints()
        Check if there are column constraints
        Returns:
        true if has column constraints
      • hasColumnConstraints

        public boolean hasColumnConstraints​(String columnName)
        Check if there are column constraints for the column name
        Parameters:
        columnName - column name
        Returns:
        true if has column constraints