org.eobjects.metamodel.schema
Class MutableTable

java.lang.Object
  extended by org.eobjects.metamodel.schema.AbstractTable
      extended by org.eobjects.metamodel.schema.MutableTable
All Implemented Interfaces:
Serializable, Comparable<Table>, NamedStructure, Table, HasName

public class MutableTable
extends AbstractTable
implements Serializable

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

Field Summary
protected  List<Column> _columns
           
protected  String _name
           
protected  String _quoteString
           
protected  List<Relationship> _relationships
           
protected  String _remarks
           
protected  Schema _schema
           
protected  TableType _type
           
 
Constructor Summary
MutableTable()
           
MutableTable(String name)
           
MutableTable(String name, TableType type)
           
MutableTable(String name, TableType type, Schema schema)
           
MutableTable(String name, TableType type, Schema schema, Column... columns)
           
 
Method Summary
 MutableTable addColumn(Column column)
           
 MutableTable addColumn(int index, Column column)
           
protected  void addRelationship(Relationship relation)
          Protected method for adding a relationship to this table.
 Column[] getColumns()
          Gets the columns of this table.
protected  List<Column> getColumnsInternal()
          Internal getter for the columns of the table.
 String getName()
          Gets the name of this Table
 String getQuote()
          Gets an optional quote string that is used to enclose the name of this structure.
 Relationship[] getRelationships()
          Gets all relationships for this table.
protected  List<Relationship> getRelationshipsInternal()
          Internal getter for the relationships of the table.
 String getRemarks()
          Gets remarks/comments to this table.
 Schema getSchema()
          Gets the schema that this table resides in.
 TableType getType()
          Gets the table type of this table.
 MutableTable removeColumn(Column column)
           
protected  MutableTable removeRelationship(Relationship relation)
          Protected method for removing a relationship from this table.
 MutableTable setColumns(Collection<Column> columns)
           
 MutableTable setColumns(Column... columns)
           
 MutableTable setName(String name)
           
 MutableTable setQuote(String quoteString)
           
 MutableTable setRemarks(String remarks)
           
 MutableTable setSchema(Schema schema)
           
 MutableTable setType(TableType type)
           
 
Methods inherited from class org.eobjects.metamodel.schema.AbstractTable
compareTo, equals, getBooleanColumns, getColumn, getColumnByName, getColumnCount, getColumnNames, getColumnsOfSuperType, getColumnsOfType, getForeignKeyRelationships, getForeignKeys, getIndexedColumns, getLiteralColumns, getNumberColumns, getPrimaryKeyRelationships, getPrimaryKeys, getQualifiedLabel, getQuotedName, getRelationshipCount, getRelationships, getTimeBasedColumns, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_name

protected String _name

_type

protected TableType _type

_remarks

protected String _remarks

_schema

protected Schema _schema

_columns

protected final List<Column> _columns

_relationships

protected final List<Relationship> _relationships

_quoteString

protected String _quoteString
Constructor Detail

MutableTable

public MutableTable()

MutableTable

public MutableTable(String name)

MutableTable

public MutableTable(String name,
                    TableType type)

MutableTable

public MutableTable(String name,
                    TableType type,
                    Schema schema)

MutableTable

public MutableTable(String name,
                    TableType type,
                    Schema schema,
                    Column... columns)
Method Detail

getName

public String getName()
Description copied from interface: Table
Gets the name of this Table

Specified by:
getName in interface NamedStructure
Specified by:
getName in interface Table
Specified by:
getName in interface HasName
Returns:
the name of this Table

setName

public MutableTable setName(String name)

getColumnsInternal

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


getColumns

public Column[] getColumns()
Description copied from interface: Table
Gets the columns of this table.

Specified by:
getColumns in interface Table
Returns:
the columns of this table.

setColumns

public MutableTable setColumns(Column... columns)

setColumns

public MutableTable setColumns(Collection<Column> columns)

addColumn

public MutableTable addColumn(Column column)

addColumn

public MutableTable addColumn(int index,
                              Column column)

removeColumn

public MutableTable removeColumn(Column column)

getSchema

public Schema getSchema()
Description copied from interface: Table
Gets the schema that this table resides in.

Specified by:
getSchema in interface Table
Returns:
the schema that the table resides in.

setSchema

public MutableTable setSchema(Schema schema)

getType

public TableType getType()
Description copied from interface: Table
Gets the table type of this table.

Specified by:
getType in interface Table
Returns:
the type of table

setType

public MutableTable setType(TableType type)

getRelationships

public Relationship[] getRelationships()
Description copied from interface: Table
Gets all relationships for this table.

Specified by:
getRelationships in interface Table
Returns:
all relationsips for this table. To add relations use TableRelation.createRelation();

addRelationship

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


removeRelationship

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


getRemarks

public String getRemarks()
Description copied from interface: Table
Gets remarks/comments to this table.

Specified by:
getRemarks in interface Table
Returns:
remarks/comments to this table or null if none exist.

setRemarks

public MutableTable setRemarks(String remarks)

getQuote

public String getQuote()
Description copied from interface: NamedStructure
Gets an optional quote string that is used to enclose the name of this structure.

Specified by:
getQuote in interface NamedStructure
Returns:
A quote string used to enclose the name or null if none exists.

setQuote

public MutableTable setQuote(String quoteString)


Copyright © 2007-2013. All Rights Reserved.