toolbox.dao
Class TableDefinition

Package class diagram package TableDefinition
java.lang.Object
  extended by toolbox.dao.TableDefinition

public class TableDefinition
extends java.lang.Object

Encapsulates the definition of a single table.


Constructor Summary
TableDefinition(java.lang.String tableName)
          Creates a new definition with the given table name.
 
Method Summary
 void addFieldDefinition(java.lang.String name, java.lang.String type, java.lang.Integer typeInt, java.lang.String allowNull, java.lang.String keyType, java.lang.String defaultVal, java.lang.String extra)
          Add a field definition to this table definition.
 FieldDefinition getFieldDefinition(java.lang.String name)
          Returns the named FieldDefinition.
 java.lang.String[] getFieldNames()
          Returns a String array of field names contained in this definition.
 FieldDefinition[] getPrimaryKeyDefinition()
          Returns the primary key definition for this table definition.
 java.lang.String[] getPrimaryKeyNames()
          Returns the names of the primary key fields of this definition
 int[] getSQLTypes()
          Return an int array containing the SQL types of all the fields in this definition.
 java.lang.String getTableName()
          Returns the name of his table definition.
 boolean isPrimaryKey(java.lang.String fieldName)
          Test to see if the given field name is containend in the primary key definition of this table definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableDefinition

public TableDefinition(java.lang.String tableName)
Creates a new definition with the given table name.

Parameters:
tableName - Name of table defined by this object.
Method Detail

getTableName

public java.lang.String getTableName()
Returns the name of his table definition.

Returns:
String containing this definitions name.

addFieldDefinition

public void addFieldDefinition(java.lang.String name,
                               java.lang.String type,
                               java.lang.Integer typeInt,
                               java.lang.String allowNull,
                               java.lang.String keyType,
                               java.lang.String defaultVal,
                               java.lang.String extra)
Add a field definition to this table definition.

Parameters:
name - Field name.
type - Field type.
typeInt - Field type as an Integer.
allowNull - Flag indicating whether or not this field is nullable.
keyType - Indicates whether or not this is a key field and also inidicates what kind of key.
defaultVal - Default value for this field.
extra - Contains additional information regarding the field.

getFieldDefinition

public FieldDefinition getFieldDefinition(java.lang.String name)
Returns the named FieldDefinition.

Parameters:
name - Name of the field to return.
Returns:
FieldDefinition with the given name.

getFieldNames

public java.lang.String[] getFieldNames()
Returns a String array of field names contained in this definition.

Returns:
String[] containing field names.

getSQLTypes

public int[] getSQLTypes()
Return an int array containing the SQL types of all the fields in this definition.

Returns:
int[] containing SQL types of all fields.

getPrimaryKeyNames

public java.lang.String[] getPrimaryKeyNames()
Returns the names of the primary key fields of this definition

Returns:
String array containing the names of the primary key fields of this definition.

getPrimaryKeyDefinition

public FieldDefinition[] getPrimaryKeyDefinition()
Returns the primary key definition for this table definition.

Returns:
FieldDefinition array containing the definition of the primary keys for this table definition.

isPrimaryKey

public boolean isPrimaryKey(java.lang.String fieldName)
Test to see if the given field name is containend in the primary key definition of this table definition.

Parameters:
fieldName - Name of field to test.
Returns:
boolean indicating whether or not the given field name forms part of the primary key definition of this table definition.