Class Table
java.lang.Object
com.invirgance.convirgance.olap.sql.Table
Provides support for a database Table representation.
- Author:
- jbanes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addForeignKey
(String foreignKey, Table target) Creates and adds the new foreignKey to this table's list of foreign keys.boolean
Compares this Table to another Table first by reference, then by instance fields (associated database, table name, and primary key),Returns the Database associated with the table.Returns the List of ForeignKey objects associated with the table.getName()
Returns the name of the Table.Returns the String with the primaryKey of the table.int
hashCode()
Returns the hashCode for the Table.void
setForeignKeys
(List<ForeignKey> foreignKeys) Sets the provided list of ForeignKey objects to this Table.void
Sets the name for the table.void
setPrimaryKey
(String primaryKey) Sets the provided string as the primaryKey for the table.
-
Constructor Details
-
Table
public Table()Creates a new instance of the Table object. -
Table
Creates a new instance of the Table with the specified name.- Parameters:
name
- the String representing the table's name.
-
Table
Creates a new instance of the Database with the specified name and primaryKey.- Parameters:
name
- the String representing the name.primaryKey
- the String representing the primaryKey.
-
-
Method Details
-
getDatabase
Returns the Database associated with the table.- Returns:
- the Database object.
-
getName
Returns the name of the Table.- Returns:
- the String with the table's name.
-
setName
Sets the name for the table.- Parameters:
name
- the String with the name.
-
getPrimaryKey
Returns the String with the primaryKey of the table.- Returns:
- String with the primaryKey.
-
setPrimaryKey
Sets the provided string as the primaryKey for the table.- Parameters:
primaryKey
- String representing the primary key.
-
getForeignKeys
Returns the List of ForeignKey objects associated with the table.- Returns:
- the List of ForeignKey objects.
-
addForeignKey
Creates and adds the new foreignKey to this table's list of foreign keys. If the table already contains the new key, does nothing.- Parameters:
foreignKey
- the String representing the foreign key.target
- the target table associated with the foreign key.
-
setForeignKeys
Sets the provided list of ForeignKey objects to this Table.- Parameters:
foreignKeys
- a list of ForeignKey objects.
-
equals
Compares this Table to another Table first by reference, then by instance fields (associated database, table name, and primary key), -
hashCode
public int hashCode()Returns the hashCode for the Table. The hashCode is based on the database associated with the table, the table's name, and its primary key.
-