Class ForeignKey

    • Constructor Detail

      • ForeignKey

        public ForeignKey()
    • Method Detail

      • setRelationType

        public final void setRelationType​(int relationType)
        Set type of relation.
        Parameters:
        relationType - Type of relation.
      • getRelationType

        public final int getRelationType()
        Get type of relation.
        Returns:
        Type of relation
      • addReferenceField

        public final void addReferenceField​(Field field)
        Add given field to list of fields referenced by the foreign key.
        Parameters:
        field - Field to add to list of fields referenced by the foreign key.
      • getReferenceFieldCount

        public final int getReferenceFieldCount()
        Get number of fields referenced by the foreign key.
        Returns:
        Number of fields referenced by the foreign key.
      • getReferenceField

        public final Field getReferenceField​(int index)
        Get field referenced by the foreign key at given index.
        Parameters:
        index - Index of referenced field to return.
        Returns:
        Referneced field at given index.
      • setReferenceTable

        public final void setReferenceTable​(Table table)
        Set table referenced by the foreign key.
        Parameters:
        table - Table referenced by the foreign key.
      • getReferenceTable

        public final Table getReferenceTable()
        Get table referenced by the foreign key.
        Returns:
        Table referenced by the foreign key.
      • addField

        public final void addField​(Field field)
        Add given field to list of foreign key fields.
        Parameters:
        field - Field to add to list of foreign key fields.
      • getFieldCount

        public final int getFieldCount()
        Get number of foreign key fields.
        Returns:
        Number of foreign key fields.
      • getField

        public final Field getField​(int index)
        Get foreign key field at given index.
        Parameters:
        index - Index of foreign key field to return.
        Returns:
        Foreign key field at given index.
      • setTable

        public final void setTable​(Table table)
        Set table that holds foreign key.
        Parameters:
        table - Table that holds foreign key.
      • getTable

        public final Table getTable()
        Get table that holds foreign key.
        Returns:
        Table that holds foreign key.
      • fieldNames

        protected final void fieldNames​(DDLWriter writer)
        Concatenate all field names delimited by field delimiter and whitespace.
        Parameters:
        writer - DDLWriter to write schema objects to.
      • referencedFieldNames

        protected final void referencedFieldNames​(DDLWriter writer)
        Concatenate all referenced field names delimited by field delimiter and whitespace.
        Parameters:
        writer - DDLWriter to write schema objects to.
      • toDropDDL

        public final void toDropDDL​(DDLWriter writer)
        Build drop script for the schema object.
        Parameters:
        writer - DDLWriter to write schema objects to.
      • merge

        public final void merge​(ForeignKey fk)
                         throws GeneratorException
        Check if given foreign key can be merged with this one.
        Parameters:
        fk - Foreign key to check if it is able to be merged.
        Throws:
        GeneratorException - If foreign keys cannot be merged.
      • equals

        public final boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object