Class CandidateKey

  • Direct Known Subclasses:
    PrimaryKey

    public class CandidateKey
    extends ColumnOrderedKey
    Representation of a Candidate key. This represents a UNIQUE candidate key on a column or columns.
    • Field Detail

      • name

        protected String name
        Name of the key.
      • table

        protected Table table
        Table that the key applies to.
      • columns

        protected List<Column> columns
        Columns that the key relates to.
    • Constructor Detail

      • CandidateKey

        public CandidateKey​(Table table,
                            Map<String,​String> extensions)
        Constructor.
        Parameters:
        table - Table to apply this key to
        extensions - Any extensions for this unique constraint
    • Method Detail

      • equals

        public boolean equals​(Object obj)
        Equality operator.
        Parameters:
        obj - Object to compare against
        Returns:
        Whether they are equal.
      • hashCode

        public int hashCode()
        Hashcode operator.
        Returns:
        The hashcode
      • toString

        public String toString()
        Stringify method. Returns
        UNIQUE (col1, ...)
        .
        Overrides:
        toString in class Object
        Returns:
        String version of this object.
      • setName

        public void setName​(String name)
        Mutator for the key name.
        Parameters:
        name - The key name
      • getName

        public String getName()
        Accessor for the key name.
        Returns:
        Key name
      • getTable

        public Table getTable()
        Accessor for the table
        Returns:
        table
      • getColumns

        public List<Column> getColumns()
        Accessor for the columns that the key relates to.
        Returns:
        the List of columns.
      • getColumnList

        public String getColumnList()
        Accessor for the column list
        Returns:
        The column list
      • assertSameDatastoreObject

        protected void assertSameDatastoreObject​(Column col)
        Utility to assert if the column is for a different table.
        Parameters:
        col - The column to compare with
      • setMinSize

        protected static void setMinSize​(List list,
                                         int size)
      • getColumnList

        public static String getColumnList​(List<Column> cols)
        Method to return the list of columns which the key applies to.
        Parameters:
        cols - The columns.
        Returns:
        The column list.