dk.eobjects.metamodel.schema
Class Table

java.lang.Object
  extended by dk.eobjects.metamodel.schema.Table
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Table>
Direct Known Subclasses:
JdbcTable

public class Table
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<Table>

Represents the metadata about a table. Tables reside within a schema and contains columns and relationships to other tables.

See Also:
Schema, Column, Relationship, Serialized Form

Constructor Summary
Table()
           
Table(java.lang.String name)
           
Table(java.lang.String name, TableType type)
           
Table(java.lang.String name, TableType type, Schema schema)
           
Table(java.lang.String name, TableType type, Schema schema, Column... columns)
           
 
Method Summary
 Table addColumn(Column column)
           
protected  Table addRelationship(Relationship relation)
          Protected method for adding a relationship to this table.
 int compareTo(Table that)
           
 boolean equals(java.lang.Object obj)
           
 Column[] getBooleanColumns()
           
 Column getColumnByName(java.lang.String columnName)
          Convenience method for retrieving a column by it's name
 int getColumnCount()
           
 java.lang.String[] getColumnNames()
           
 Column[] getColumns()
           
protected  java.util.List<Column> getColumnsInternal()
          Internal getter for the columns of the table.
 Column[] getColumnsOfType(ColumnType columnType)
           
 Relationship[] getForeignKeyRelationships()
           
 Column[] getForeignKeys()
           
 Column[] getIndexedColumns()
           
 Column[] getLiteralColumns()
           
 java.lang.String getName()
           
 Column[] getNumberColumns()
           
 Relationship[] getPrimaryKeyRelationships()
           
 Column[] getPrimaryKeys()
           
 java.lang.String getQuote()
           
 java.lang.String getQuotedName()
           
 int getRelationshipCount()
           
 Relationship[] getRelationships()
           
 Relationship[] getRelationships(Table otherTable)
           
protected  java.util.List<Relationship> getRelationshipsInternal()
          Internal getter for the relationships of the table.
 java.lang.String getRemarks()
           
 Schema getSchema()
           
 Column[] getTimeBasedColumns()
           
 TableType getType()
           
 int hashCode()
           
 Table removeColumn(Column column)
           
protected  Table removeRelationship(Relationship relation)
          Protected method for removing a relationship from this table.
 Table setColumns(java.util.Collection<Column> columns)
           
 Table setColumns(Column... columns)
           
 Table setName(java.lang.String name)
           
 Table setQuote(java.lang.String quoteString)
           
 void setRemarks(java.lang.String remarks)
           
 Table setSchema(Schema schema)
           
 Table setType(TableType type)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Table

public Table()

Table

public Table(java.lang.String name)

Table

public Table(java.lang.String name,
             TableType type)

Table

public Table(java.lang.String name,
             TableType type,
             Schema schema)

Table

public Table(java.lang.String name,
             TableType type,
             Schema schema,
             Column... columns)
Method Detail

getName

public java.lang.String getName()
Returns:
the name of the table

setName

public Table setName(java.lang.String name)

getColumnsInternal

protected java.util.List<Column> getColumnsInternal()
Internal getter for the columns of the table. Overwrite this method to implement column lookup, column lazy-loading or similar.


getRelationshipsInternal

protected java.util.List<Relationship> getRelationshipsInternal()
Internal getter for the relationships of the table. Overwrite this method to implement relationship lookup, relationship lazy-loading or similar.


getColumnCount

public int getColumnCount()
Returns:
the number of columns in this table

getColumns

public Column[] getColumns()
Returns:
the columns of the table

setColumns

public Table setColumns(Column... columns)

setColumns

public Table setColumns(java.util.Collection<Column> columns)

addColumn

public Table addColumn(Column column)

removeColumn

public Table removeColumn(Column column)

getColumnByName

public Column getColumnByName(java.lang.String columnName)
Convenience method for retrieving a column by it's name

Parameters:
columnName - the name of the column to retrieve
Returns:
the column with the given name. Returns null if no such column is found.

getSchema

public Schema getSchema()
Returns:
the schema that the table belong to

setSchema

public Table setSchema(Schema schema)

getType

public TableType getType()
Returns:
the type of table

setType

public Table setType(TableType type)

getRelationships

public Relationship[] getRelationships()
Returns:
all relations for this table. To add relations use TableRelation.createRelation();

getRelationships

public Relationship[] getRelationships(Table otherTable)
Parameters:
otherTable -
Returns:
this tables relationsips to another table

addRelationship

protected Table addRelationship(Relationship relation)
Protected method for adding a relationship to this table. Should not be used. Use Relationship.createRelationship(Column[], Column[]) instead.


removeRelationship

protected Table removeRelationship(Relationship relation)
Protected method for removing a relationship from this table. Should not be used. Use Relationship.remove() instead.


getRelationshipCount

public int getRelationshipCount()

getRemarks

public java.lang.String getRemarks()

setRemarks

public void setRemarks(java.lang.String remarks)

getQuote

public java.lang.String getQuote()

setQuote

public Table setQuote(java.lang.String quoteString)

getQuotedName

public java.lang.String getQuotedName()

getNumberColumns

public Column[] getNumberColumns()

getLiteralColumns

public Column[] getLiteralColumns()

getTimeBasedColumns

public Column[] getTimeBasedColumns()

getBooleanColumns

public Column[] getBooleanColumns()

getIndexedColumns

public Column[] getIndexedColumns()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

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

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(Table that)
Specified by:
compareTo in interface java.lang.Comparable<Table>

getForeignKeyRelationships

public Relationship[] getForeignKeyRelationships()
Returns:
the relationships where this table is the foreign table

getPrimaryKeyRelationships

public Relationship[] getPrimaryKeyRelationships()
Returns:
the relationships where this table is the primary table

getForeignKeys

public Column[] getForeignKeys()

getPrimaryKeys

public Column[] getPrimaryKeys()

getColumnNames

public java.lang.String[] getColumnNames()

getColumnsOfType

public Column[] getColumnsOfType(ColumnType columnType)


Copyright © 2007-2008. All Rights Reserved.