Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.table.db
Class DefaultDatabaseTableDefinition

java.lang.Object
  extended by com.sciapp.table.db.DefaultDatabaseTableDefinition
All Implemented Interfaces:
DatabaseTableDefinition, TableDefinition
Direct Known Subclasses:
DefaultMeasureDefinition

public class DefaultDatabaseTableDefinition
extends Object
implements DatabaseTableDefinition

DefaultDatabaseTableDefinition allows an easy definition to be created.


Field Summary
protected  Class[] classes
          the Java classes of the columns
protected  String[] columns
          the table columns
protected  String[] dbColumns
          the database columns
 
Constructor Summary
DefaultDatabaseTableDefinition()
          Constructs a DefaultDatabaseTableDefinition with no columns defined.
DefaultDatabaseTableDefinition(String[] columns)
          Constructs a DefaultDatabaseTableDefinition.
DefaultDatabaseTableDefinition(String[] columns, Class[] classes)
          Constructs a DefaultDatabaseTableDefinition.
DefaultDatabaseTableDefinition(String[] columns, Class[] classes, String[] dbColumns)
          Constructs a DefaultDatabaseTableDefinition.
 
Method Summary
 void addColumn(String column, Class columnClass, String dbColumn)
          Adds the column to the definition.
protected  void clear()
          Clears the definition of any columns.
 Class getColumnClass(int index)
          Returns the class of all the cells in the column.
 int getColumnCount()
          Returns the number of columns.
 String getColumnName(int index)
          Returns the name of the column at columnIndex as it will be displayed by the table
 String getDatabaseColumn(int index)
          Returns the name of the column at columnIndex as it exists in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columns

protected String[] columns
the table columns


classes

protected Class[] classes
the Java classes of the columns


dbColumns

protected String[] dbColumns
the database columns

Constructor Detail

DefaultDatabaseTableDefinition

public DefaultDatabaseTableDefinition()
Constructs a DefaultDatabaseTableDefinition with no columns defined.


DefaultDatabaseTableDefinition

public DefaultDatabaseTableDefinition(String[] columns)
Constructs a DefaultDatabaseTableDefinition. The class of each columns defaults to an Object.class, while the database column names are those specified by columns.


DefaultDatabaseTableDefinition

public DefaultDatabaseTableDefinition(String[] columns,
                                      Class[] classes)
Constructs a DefaultDatabaseTableDefinition. The database column names are those specified by columns.


DefaultDatabaseTableDefinition

public DefaultDatabaseTableDefinition(String[] columns,
                                      Class[] classes,
                                      String[] dbColumns)
Constructs a DefaultDatabaseTableDefinition.

Method Detail

addColumn

public void addColumn(String column,
                      Class columnClass,
                      String dbColumn)
Adds the column to the definition.

Parameters:
column - the name of the column as it appears on the table
columnClass - the java class of the column
dbColumn - the name of the column as it appears on the database

clear

protected void clear()
Clears the definition of any columns.


getColumnClass

public Class getColumnClass(int index)
Returns the class of all the cells in the column.

Specified by:
getColumnClass in interface TableDefinition
Parameters:
index - the index of the column
Returns:
the class of all the cells in the column.

getColumnCount

public int getColumnCount()
Returns the number of columns.

Specified by:
getColumnCount in interface TableDefinition
Returns:
the number of columns.

getColumnName

public String getColumnName(int index)
Returns the name of the column at columnIndex as it will be displayed by the table

Specified by:
getColumnName in interface TableDefinition
Parameters:
index - the index of the column
Returns:
the name of the column

getDatabaseColumn

public String getDatabaseColumn(int index)
Returns the name of the column at columnIndex as it exists in the database.

Specified by:
getDatabaseColumn in interface DatabaseTableDefinition
Parameters:
index - the index of the column
Returns:
the name of the column in the database

Copyright © 2005 Scientific Applications. All Rights Reserved.