org.clazzes.jdbc2xml.schema
Class TableInfo

java.lang.Object
  extended by org.clazzes.jdbc2xml.schema.TableInfo

public class TableInfo
extends java.lang.Object

This class hold everything we need to known about a database table.

Author:
wglas

Constructor Summary
TableInfo()
          Default constructor
TableInfo(java.lang.String name)
          Constructor with table name.
 
Method Summary
 void addColumn(ColumnInfo ci)
          Add a column to our list of column descriptions.
 void addForeignKey(ForeignKeyInfo fki)
          Add a foreign key to our list of foreign key descriptions.
 void addIndex(IndexInfo indexInfo)
          Add an index to the list of indices.
 void addIndex(java.lang.String indexName, java.lang.String indexColumns, boolean unique, java.lang.String filterCondition)
          Add an index to the list of indices.
 ColumnInfo getColumnInfo(java.lang.String columnName)
          Return the column info for the given column name.
 java.util.List<ColumnInfo> getColumns()
           
 java.lang.String getComment()
           
 ForeignKeyInfo getForeignKeyInfo(java.lang.String fkName)
          Get a ForeignKeyInfo for a specified foreign-key-name.
 java.util.List<ForeignKeyInfo> getForeignKeys()
           
 IndexInfo getIndexInfo(java.lang.String idxName)
          Get a IndexInfo for a specified foreign-key-name.
 java.util.List<IndexInfo> getIndices()
           
 java.lang.String getName()
           
 PrimaryKeyInfo getPrimaryKey()
           
 boolean indexContainsNullableColumns(IndexInfo indexInfo)
          Investigates if an IndexInfo contains a NULLable column
 void removeColumnInfo(java.lang.String columnName)
          Remove a defined ColumnInfo.
 void removeForeignKey(java.lang.String fkName)
          Remove a defined ForeignKeyInfo.
 void removeIndex(java.lang.String indexName)
          Remove a defined indexInfo.
 void replaceColumnInfo(java.lang.String columnName, ColumnInfo newColumnInfo)
          Replace a defined ColumnInfo by another one.
 void setColumns(java.util.List<ColumnInfo> columns)
           
 void setComment(java.lang.String comment)
           
 void setForeignKeys(java.util.List<ForeignKeyInfo> foreignKeys)
           
 void setIndices(java.util.List<IndexInfo> indices)
           
 void setName(java.lang.String name)
           
 void setPrimaryKey(PrimaryKeyInfo primaryKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableInfo

public TableInfo()
Default constructor


TableInfo

public TableInfo(java.lang.String name)
Constructor with table name.

Method Detail

getName

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

setName

public void setName(java.lang.String name)
Parameters:
name - the name to set

getComment

public java.lang.String getComment()
Returns:
the comment

setComment

public void setComment(java.lang.String comment)
Parameters:
comment - the comment to set

getColumns

public java.util.List<ColumnInfo> getColumns()
Returns:
the columns

setColumns

public void setColumns(java.util.List<ColumnInfo> columns)
Parameters:
columns - the columns to set

addColumn

public void addColumn(ColumnInfo ci)
Add a column to our list of column descriptions.

Parameters:
ci - The ColumnInfo to add.

getColumnInfo

public ColumnInfo getColumnInfo(java.lang.String columnName)
Return the column info for the given column name.

Parameters:
columnName - The name of the column to seek for.
Returns:
The column information or null, if the column could not be found.

replaceColumnInfo

public void replaceColumnInfo(java.lang.String columnName,
                              ColumnInfo newColumnInfo)
Replace a defined ColumnInfo by another one. If not found, nothing happens.

Parameters:
columnName - Name of the column to replace.
newColumnInfo - The new ColumnInfo for the specified column.

removeColumnInfo

public void removeColumnInfo(java.lang.String columnName)
Remove a defined ColumnInfo. If not found, nothing happens.

Parameters:
columnName - Name of the column to remove.

removeIndex

public void removeIndex(java.lang.String indexName)
Remove a defined indexInfo. If not found, nothing happens.

Parameters:
indexName - Name of the index to remove.

getPrimaryKey

public PrimaryKeyInfo getPrimaryKey()
Returns:
the primaryKey

setPrimaryKey

public void setPrimaryKey(PrimaryKeyInfo primaryKey)
Parameters:
primaryKey - The primary key to set.

getForeignKeys

public java.util.List<ForeignKeyInfo> getForeignKeys()
Returns:
the foreignKeys

setForeignKeys

public void setForeignKeys(java.util.List<ForeignKeyInfo> foreignKeys)
Parameters:
foreignKeys - the foreignKeys to set

addForeignKey

public void addForeignKey(ForeignKeyInfo fki)
Add a foreign key to our list of foreign key descriptions.

Parameters:
fki - The PrimaryKeyInfo to add.

getForeignKeyInfo

public ForeignKeyInfo getForeignKeyInfo(java.lang.String fkName)
Get a ForeignKeyInfo for a specified foreign-key-name.

Parameters:
fkName - Name of the foreign key to get.
Returns:
The ForeignKeyInfo found, or null if not found.

getIndexInfo

public IndexInfo getIndexInfo(java.lang.String idxName)
Get a IndexInfo for a specified foreign-key-name.

Parameters:
idxName - Name of the index to get.
Returns:
The IndexInfo found, or null if not found.

removeForeignKey

public void removeForeignKey(java.lang.String fkName)
Remove a defined ForeignKeyInfo. If not found, nothing happens.

Parameters:
fkName - Name of the foreign key to remove.

getIndices

public java.util.List<IndexInfo> getIndices()
Returns:
The list of table indices.

setIndices

public void setIndices(java.util.List<IndexInfo> indices)
Parameters:
indices - The list of indices to set.

addIndex

public void addIndex(IndexInfo indexInfo)
Add an index to the list of indices.

Parameters:
indexInfo - The index to add.

addIndex

public void addIndex(java.lang.String indexName,
                     java.lang.String indexColumns,
                     boolean unique,
                     java.lang.String filterCondition)
Add an index to the list of indices.

Parameters:
indexName - name of the index
indexColumns - column list
unique - if the index should be unique
filterCondition -

indexContainsNullableColumns

public boolean indexContainsNullableColumns(IndexInfo indexInfo)
Investigates if an IndexInfo contains a NULLable column

Parameters:
indexInfo - the Index to investigate
Returns:
true if the IndexInfo contains a NULLable column


Copyright © 2007. All Rights Reserved.