org.brains2b.sql.meta
Class TableModel

java.lang.Object
  extended by org.brains2b.sql.meta.TableModel
All Implemented Interfaces:
SQLMetaModel

public class TableModel
extends java.lang.Object
implements SQLMetaModel

Wrapper around table definition from DatabaseMetaData

Class is read-only, use SquelerDDL:TableDDL for changing columns

Version:
1.01 [Oct 23, 2007]
Author:
dennis@brains2b.nl
See Also:
SQLMetaData, SQLRecord

Constructor Summary
protected TableModel()
          Constructor only used by TableDDL
  TableModel(SQLRecord record)
          Create a TableModel on the basis of this SQLRecord
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getCatalog()
          get the Catalog for this TableModel
 java.util.List getColumns()
          get the columns for this Table
 java.util.List getIndices()
          get the indices for this Table
 java.lang.String getName()
          get the name for this model's instance
 ConstraintModel getPrimaryKey()
          get the primary key for this table in the form of a ConstraintModel of type ConstraintModel.PRIMARY_KEY
 SQLRecord getRecord()
          the record which defines all the values for the model
 java.lang.String getRemarks()
          get optional remarks for this table
 java.lang.String getSchema()
          get the Schema for this TableModel
 java.lang.String getType()
          get the type of Object defined by the meta model
protected  void setColumns(java.util.List columns)
          set the columns for this TableModel
protected  void setIndices(java.util.List indices)
          set the indices for this Model
protected  void setPrimaryKey(ConstraintModel primaryKey)
          set the primary key for this table
protected  void setRecord(SQLRecord record)
          set the record for this Model
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableModel

protected TableModel()
Constructor only used by TableDDL


TableModel

public TableModel(SQLRecord record)
Create a TableModel on the basis of this SQLRecord

Parameters:
record - SQLRecord, the record containing the information for this table
Method Detail

getName

public java.lang.String getName()
get the name for this model's instance

This is equal to the name of the table,column, etc.

Specified by:
getName in interface SQLMetaModel
Returns:
String

getCatalog

public java.lang.String getCatalog()
get the Catalog for this TableModel

Returns:
String, null if this table does not have a catalog

getSchema

public java.lang.String getSchema()
get the Schema for this TableModel

Returns:
String, null if this table does not have a schema

getRemarks

public java.lang.String getRemarks()
get optional remarks for this table

Returns:
String, the remarks for this table

getRecord

public SQLRecord getRecord()
the record which defines all the values for the model

Specified by:
getRecord in interface SQLMetaModel
Returns:
SQLRecord

getType

public java.lang.String getType()
get the type of Object defined by the meta model

returned value depends on the model: TABLE,COLUMN,INDEX

Specified by:
getType in interface SQLMetaModel
Returns:
String

getColumns

public java.util.List getColumns()
get the columns for this Table

Returns:
List of ColumnModel

setColumns

protected void setColumns(java.util.List columns)
set the columns for this TableModel

Parameters:
List - of ColumnModel

getIndices

public java.util.List getIndices()
get the indices for this Table

Returns:
List of IndexModel

setIndices

protected void setIndices(java.util.List indices)
set the indices for this Model

Parameters:
List - of IndexModel

setPrimaryKey

protected void setPrimaryKey(ConstraintModel primaryKey)
set the primary key for this table

Parameters:
ConstraintModel -
Throws:
java.lang.IllegalArgumentException - if the ConstraintModel is not of type ConstraintModel.PRIMARY_KEY

setRecord

protected void setRecord(SQLRecord record)
set the record for this Model

Parameters:
record - SQLRecord

getPrimaryKey

public ConstraintModel getPrimaryKey()
get the primary key for this table in the form of a ConstraintModel of type ConstraintModel.PRIMARY_KEY

Returns:
ConstraintModel

equals

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