pl.kernelpanic.dbmonster.schema
Class Table

java.lang.Object
  extended by pl.kernelpanic.dbmonster.schema.Table
All Implemented Interfaces:
Comparable

public class Table
extends Object
implements Comparable

The table.

Version:
$Id: Table.java,v 1.9 2006/01/05 16:29:37 majek Exp $
Author:
Piotr Maj <pm@jcake.com>

Constructor Summary
Table()
           
 
Method Summary
 void addColumn(Column column)
          Adds a column to the schema.
 Iterator columnIterator()
          Returns a column iterator.
 int compareTo(Object o)
           
 boolean containsColumn(String name)
           
 Column findColumn(String name)
           
 void generate()
          Generates the table.
 List getColumns()
          Returns list of columns.
 Key getKey()
          Returns a key.
 String getName()
          Returns the name of the table.
 int getRows()
          Returns the number of rows we want to generate for this table.
 Schema getSchema()
          Returns schema.
 String getUnqualifiedName()
          Returns the name of this table, minus any schema prefix if one exists.
 void initialize(DBMonsterContext ctx)
          Initializes the table.
 boolean isGenerated()
          Checks if the table is already generated.
 void removeColumn(Column column)
          Removes column from table.
 void reset()
          Resets the entire table and mark it as if it was not generated.
 void resetColumns()
          Resets key and all columns.
 void setKey(Key k)
          Sets the key.
 void setName(String s)
          Sets the name of the table.
 void setRows(int i)
          Sets the number of rows.
 void setSchema(Schema s)
          Sets the schema - it cannot be null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Table

public Table()
Method Detail

getName

public String getName()
Returns the name of the table.

Returns:
the name of the table.

setName

public void setName(String s)
Sets the name of the table.

Parameters:
s - the name of the table.

getSchema

public Schema getSchema()
Returns schema.

Returns:
the schema

setSchema

public void setSchema(Schema s)
Sets the schema - it cannot be null.

Parameters:
s - a schema

addColumn

public void addColumn(Column column)
               throws SchemaException
Adds a column to the schema.

Parameters:
column - the column to add
Throws:
SchemaException - on schema error.

setKey

public void setKey(Key k)
Sets the key.

Parameters:
k - key

getKey

public Key getKey()
Returns a key.

Returns:
a key

initialize

public void initialize(DBMonsterContext ctx)
                throws Exception
Initializes the table.

Parameters:
ctx - dbmonster context.
Throws:
Exception - if initialization fails

generate

public void generate()
              throws Exception
Generates the table.

Throws:
Exception - if table generation fails

resetColumns

public void resetColumns()
Resets key and all columns.


reset

public void reset()
Resets the entire table and mark it as if it was not generated.


getRows

public int getRows()
Returns the number of rows we want to generate for this table.

Returns:
number of rows

setRows

public void setRows(int i)
Sets the number of rows.

Parameters:
i - number of rows

isGenerated

public boolean isGenerated()
Checks if the table is already generated.

Returns:
true if the table is already generated.

columnIterator

public Iterator columnIterator()
Returns a column iterator.

Returns:
iterator over columns

getColumns

public List getColumns()
Returns list of columns.

Returns:
list of columns

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(java.lang.Object)

removeColumn

public void removeColumn(Column column)
Removes column from table.

Parameters:
column - column to remove

containsColumn

public boolean containsColumn(String name)

findColumn

public Column findColumn(String name)

getUnqualifiedName

public String getUnqualifiedName()
Returns the name of this table, minus any schema prefix if one exists.

Returns:
the table name minus schema prefix.


Copyright © 2003-2006 .:. kernelpanic.pl .:.. All Rights Reserved.