Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.ddlutils.model
Class ForeignKey

    java.lang.Object
      org.apache.ddlutils.model.ForeignKey

All Implemented Interfaces:
  Cloneable

    public class ForeignKey

extends Object
implements Cloneable

Represents a database foreign key.

Version:
  $Revision: 504014 $

Constructor Summary
`ForeignKey()` Creates a new foreign key object that has no name.
`ForeignKey(String name)` Creates a new foreign key object.

Method Summary
`void` | `addReference(Reference reference)` Adds a reference, ie.
`Object` | `clone()`
`boolean` | `equals(Object obj)`
`boolean` | `equalsIgnoreCase(ForeignKey otherFk)` Compares this foreign key to the given one while ignoring the case of identifiers.
`Reference` | `getFirstReference()` Returns the first reference if it exists.
`Table` | `getForeignTable()` Returns the foreign table.
`String` | `getForeignTableName()` Returns the name of the foreign table.
`String` | `getName()` Returns the name of this foreign key.
`Reference` | `getReference(int idx)` Returns the indicated reference.
`int` | `getReferenceCount()` Returns the number of references.
`Reference[]` | `getReferences()` Returns the references.
`boolean` | `hasForeignColumn(Column column)` Determines whether this foreign key uses the given column as a foreign column in a reference.
`int` | `hashCode()`
`boolean` | `hasLocalColumn(Column column)` Determines whether this foreign key uses the given column as a local column in a reference.
`boolean` | `isAutoIndexPresent()` Determines whether this foreign key has an auto-generated associated index.
`void` | `removeReference(int idx)` Removes the indicated reference.
`void` | `removeReference(Reference reference)` Removes the given reference.
`void` | `setAutoIndexPresent(boolean autoIndexPresent)` Specifies whether this foreign key has an auto-generated associated index.
`void` | `setForeignTable(Table foreignTable)` Sets the foreign table.
`void` | `setForeignTableName(String foreignTableName)` Sets the name of the foreign table.
`void` | `setName(String name)` Sets the name of this foreign key.
`String` | `toString()`
`String` | `toVerboseString()` Returns a verbose string representation of this foreign key.

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ForeignKey

    public ForeignKey()

  Creates a new foreign key object that has no name.

### ForeignKey

    public ForeignKey(String name)

  Creates a new foreign key object.

  Parameters:
    `name` - The name of the foreign key

Method Detail

### getName

    public String getName()

  Returns the name of this foreign key.

  Returns:
    The name

### setName

    public void setName(String name)

  Sets the name of this foreign key.

  Parameters:
    `name` - The name

### getForeignTable

    public Table getForeignTable()

  Returns the foreign table.

  Returns:
    The foreign table

### setForeignTable

    public void setForeignTable(Table foreignTable)

  Sets the foreign table.

  Parameters:
    `foreignTable` - The foreign table

### getForeignTableName

    public String getForeignTableName()

  Returns the name of the foreign table.

  Returns:
    The table name

### setForeignTableName

    public void setForeignTableName(String foreignTableName)

  Sets the name of the foreign table. Please note that you should not use this method when manually constructing or manipulating the database model. Rather utilize the `setForeignTable(Table)` method.

  Parameters:
    `foreignTableName` - The table name

### getReferenceCount

    public int getReferenceCount()

  Returns the number of references.

  Returns:
    The number of references

### getReference

    public Reference getReference(int idx)

  Returns the indicated reference.

  Parameters:
    `idx` - The index
  Returns:
    The reference

### getReferences

    public Reference[] getReferences()

  Returns the references.

  Returns:
    The references

### getFirstReference

    public Reference getFirstReference()

  Returns the first reference if it exists.

  Returns:
    The first reference

### addReference

    public void addReference(Reference reference)

  Adds a reference, ie. a mapping between a local column (in the table that owns this foreign key) and a remote column.

  Parameters:
    `reference` - The reference to add

### removeReference

    public void removeReference(Reference reference)

  Removes the given reference.

  Parameters:
    `reference` - The reference to remove

### removeReference

    public void removeReference(int idx)

  Removes the indicated reference.

  Parameters:
    `idx` - The index of the reference to remove

### hasLocalColumn

    public boolean hasLocalColumn(Column column)

  Determines whether this foreign key uses the given column as a local column in a reference.

  Parameters:
    `column` - The column to check
  Returns:
    `true` if a reference uses the column as a local column

### hasForeignColumn

    public boolean hasForeignColumn(Column column)

  Determines whether this foreign key uses the given column as a foreign column in a reference.

  Parameters:
    `column` - The column to check
  Returns:
    `true` if a reference uses the column as a foreign column

### isAutoIndexPresent

    public boolean isAutoIndexPresent()

  Determines whether this foreign key has an auto-generated associated index.

  Returns:
    `true` if an auto-generated index exists

### setAutoIndexPresent

    public void setAutoIndexPresent(boolean autoIndexPresent)

  Specifies whether this foreign key has an auto-generated associated index.

  Parameters:
    `autoIndexPresent` - `true` if an auto-generated index exists

### clone

    public Object clone()
                 throws CloneNotSupportedException

  Overrides:
    `clone` in class `Object`
  Throws:
    `CloneNotSupportedException`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### equalsIgnoreCase

    public boolean equalsIgnoreCase(ForeignKey otherFk)

  Compares this foreign key to the given one while ignoring the case of identifiers.

  Parameters:
    `otherFk` - The other foreign key
  Returns:
    `true` if this foreign key is equal (ignoring case) to the given one

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### toVerboseString

    public String toVerboseString()

  Returns a verbose string representation of this foreign key.

  Returns:
    The string representation

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.