net.sf.jaxme.sqls.impl
Class TableImpl

java.lang.Object
  extended bynet.sf.jaxme.sqls.impl.TableImpl
All Implemented Interfaces:
Table
Direct Known Subclasses:
DB2TableImpl, HsqlDbTableImpl

public class TableImpl
extends java.lang.Object
implements Table

Author:
Jochen Wiedmann

Nested Class Summary
static class TableImpl.NameImpl
           
 
Nested classes inherited from class net.sf.jaxme.sqls.Table
Table.Name
 
Constructor Summary
protected TableImpl(Schema pSchema, Table.Name pName)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 Column getColumn(Column.Name pName)
          Returns the column with the given name or null, if no such column exists.
 Column getColumn(java.lang.String pName)
          Returns the column with the given name or null, if no such column exists.
 java.util.Iterator getColumns()
          Returns the table columns.
 DeleteStatement getDeleteStatement()
          Returns an UPDATE statement for updating a column in the table.
 java.util.Iterator getForeignKeys()
          Returns an Iterator to the foreign keys defined on the table.
 java.util.Iterator getIndexes()
          Returns an Iterator to the indexes defined on the table.
 InsertStatement getInsertStatement()
          Returns an INSERT statement for filling all the values.
 Table.Name getName()
          Returns the table name.
 Index getPrimaryKey()
          Returns the tables primary key, if any, or null, if the table doesn't have a primary key.
 java.lang.String getQName()
          Returns the tables qualified name, which is getSchema().getName() + "." + getName().
 Schema getSchema()
          Returns the table schema.
 SelectStatement getSelectStatement()
          Returns a SELECT statement for selecting all the columns.
 UpdateStatement getUpdateStatement()
          Returns an UPDATE statement for updating a column in the table.
 int hashCode()
           
 Column newColumn(Column.Name pName, Column.Type pType)
          Creates a new column.
 Column newColumn(java.lang.String pName, Column.Type pType)
          Creates a new column.
 ForeignKey newForeignKey(Table pTable)
          Creates a new foreign key referencing the given table.
 Index newIndex()
          Creates a new, non-unique index on the table.
 Index newKey()
          Creates a new, unique index on the table.
 Index newPrimaryKey()
          Creates a new primary key on the table.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableImpl

protected TableImpl(Schema pSchema,
                    Table.Name pName)
Method Detail

getSchema

public Schema getSchema()
Description copied from interface: Table

Returns the table schema.

Specified by:
getSchema in interface Table

getName

public Table.Name getName()
Description copied from interface: Table

Returns the table name.

Specified by:
getName in interface Table

getQName

public java.lang.String getQName()
Description copied from interface: Table

Returns the tables qualified name, which is getSchema().getName() + "." + getName(). If the schema is the default schema, returns getName().

Specified by:
getQName in interface Table

getColumns

public java.util.Iterator getColumns()
Description copied from interface: Table

Returns the table columns.

Specified by:
getColumns in interface Table

newColumn

public Column newColumn(java.lang.String pName,
                        Column.Type pType)
Description copied from interface: Table

Creates a new column.

Specified by:
newColumn in interface Table

newColumn

public Column newColumn(Column.Name pName,
                        Column.Type pType)
Description copied from interface: Table

Creates a new column.

Specified by:
newColumn in interface Table

getColumn

public Column getColumn(Column.Name pName)
Description copied from interface: Table

Returns the column with the given name or null, if no such column exists.

Specified by:
getColumn in interface Table

getColumn

public Column getColumn(java.lang.String pName)
Description copied from interface: Table

Returns the column with the given name or null, if no such column exists.

Specified by:
getColumn in interface Table

newKey

public Index newKey()
Description copied from interface: Table

Creates a new, unique index on the table.

Specified by:
newKey in interface Table

newIndex

public Index newIndex()
Description copied from interface: Table

Creates a new, non-unique index on the table.

Specified by:
newIndex in interface Table

getPrimaryKey

public Index getPrimaryKey()
Description copied from interface: Table

Returns the tables primary key, if any, or null, if the table doesn't have a primary key.

Specified by:
getPrimaryKey in interface Table

getIndexes

public java.util.Iterator getIndexes()
Description copied from interface: Table

Returns an Iterator to the indexes defined on the table. This iterator includes the primary key, if any.

Specified by:
getIndexes in interface Table

newPrimaryKey

public Index newPrimaryKey()
Description copied from interface: Table

Creates a new primary key on the table.

Specified by:
newPrimaryKey in interface Table

getForeignKeys

public java.util.Iterator getForeignKeys()
Description copied from interface: Table

Returns an Iterator to the foreign keys defined on the table.

Specified by:
getForeignKeys in interface Table

newForeignKey

public ForeignKey newForeignKey(Table pTable)
Description copied from interface: Table

Creates a new foreign key referencing the given table.

Specified by:
newForeignKey in interface Table

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()

getInsertStatement

public InsertStatement getInsertStatement()
Description copied from interface: Table

Returns an INSERT statement for filling all the values. In other words: If the table FOO has the columns A, B, and C, then the statement INSERT INTO FOO (A,B,C) VALUES (?, ?, ?) will be returned.

Specified by:
getInsertStatement in interface Table
See Also:
SQLFactory.newInsertStatement()

getSelectStatement

public SelectStatement getSelectStatement()
Description copied from interface: Table

Returns a SELECT statement for selecting all the columns. In other words: If the table FOO has the columns A, B, and C, then the statement SELECT A, B, C FROM FOO will be returned.

Specified by:
getSelectStatement in interface Table
See Also:
SQLFactory.newSelectStatement()

getUpdateStatement

public UpdateStatement getUpdateStatement()
Description copied from interface: Table

Returns an UPDATE statement for updating a column in the table. In other words: If the table FOO has the columns A, B, C and D with the primary key columns A and B, then the statement UPDATE FOO SET C = ?, D = ? WHERE A = ? AND B = ? will be returned.

Specified by:
getUpdateStatement in interface Table
See Also:
SQLFactory.newUpdateStatement()

getDeleteStatement

public DeleteStatement getDeleteStatement()
Description copied from interface: Table

Returns an UPDATE statement for updating a column in the table. In other words: If the table FOO has the primary key columns A and B, then the statement DELETE FROM FOO WHERE A = ? AND B = ? will be returned.

Specified by:
getDeleteStatement in interface Table
See Also:
SQLFactory.newDeleteStatement()