public class Database extends Object implements Serializable, Cloneable
| Constructor and Description |
|---|
Database() |
| Modifier and Type | Method and Description |
|---|---|
void |
addTable(int idx,
Table table)
Adds a table at the specified position.
|
void |
addTable(Table table)
Adds a table.
|
void |
addTables(Collection tables)
Adds the given tables.
|
Object |
clone() |
org.apache.commons.beanutils.DynaBean |
createDynaBeanFor(String tableName,
boolean caseSensitive)
Convenience method that combines
createDynaBeanFor(Table) and
findTable(String, boolean). |
org.apache.commons.beanutils.DynaBean |
createDynaBeanFor(Table table)
Creates a new dyna bean for the given table.
|
boolean |
equals(Object obj) |
Table |
findTable(String name)
Finds the table with the specified name, using case insensitive matching.
|
Table |
findTable(String name,
boolean caseSensitive)
Finds the table with the specified name, using case insensitive matching.
|
SqlDynaClass |
getDynaClassFor(org.apache.commons.beanutils.DynaBean bean)
Returns the
SqlDynaClass for the given dyna bean. |
SqlDynaClass |
getDynaClassFor(String tableName)
Returns the
SqlDynaClass for the given table name. |
String |
getIdMethod()
Returns the method for generating primary key values.
|
String |
getName()
Returns the name of this database model.
|
Table |
getTable(int idx)
Returns the table at the specified position.
|
int |
getTableCount()
Returns the number of tables in this model.
|
Table[] |
getTables()
Returns the tables in this model.
|
String |
getVersion()
Returns the version of this database model.
|
int |
hashCode() |
void |
initialize()
Initializes the model by establishing the relationships between elements in this model encoded
eg.
|
void |
mergeWith(Database otherDb)
Adds all tables from the other database to this database.
|
void |
removeTable(int idx)
Removes the indicated table.
|
void |
removeTable(Table table)
Removes the given table.
|
void |
resetDynaClassCache()
Resets the dyna class cache.
|
void |
setIdMethod(String idMethod)
Sets the method for generating primary key values.
|
void |
setName(String name)
Sets the name of this database model.
|
void |
setVersion(String version)
Sets the version of this database model.
|
String |
toString() |
String |
toVerboseString()
Returns a verbose string representation of this database.
|
public void mergeWith(Database otherDb) throws ModelException
otherDb - The other database modelModelExceptionpublic String getName()
public void setName(String name)
name - The namepublic String getVersion()
public void setVersion(String version)
version - The versionpublic String getIdMethod()
public void setIdMethod(String idMethod)
idMethod - The methodpublic int getTableCount()
public Table[] getTables()
public Table getTable(int idx)
idx - The index of the tablepublic void addTable(Table table)
table - The table to addpublic void addTable(int idx,
Table table)
idx - The index where to insert the tabletable - The table to addpublic void addTables(Collection tables)
tables - The tables to addpublic void removeTable(Table table)
table - The table to removepublic void removeTable(int idx)
idx - The index of the table to removepublic void initialize()
throws ModelException
ModelExceptionpublic Table findTable(String name)
name - The name of the table to findnull if there is no such tablepublic Table findTable(String name, boolean caseSensitive)
name - The name of the table to findcaseSensitive - Whether case matters for the namesnull if there is no such tablepublic void resetDynaClassCache()
public SqlDynaClass getDynaClassFor(String tableName)
SqlDynaClass for the given table name. If the it does not
exist yet, a new one will be created based on the Table definition.tableName - The name of the table to create the bean forSqlDynaClass for the indicated table or null
if the model contains no such tablepublic SqlDynaClass getDynaClassFor(org.apache.commons.beanutils.DynaBean bean)
SqlDynaClass for the given dyna bean.bean - The dyna beanSqlDynaClass for the given beanpublic org.apache.commons.beanutils.DynaBean createDynaBeanFor(Table table) throws SqlDynaException
table - The table to create the bean forSqlDynaExceptionpublic org.apache.commons.beanutils.DynaBean createDynaBeanFor(String tableName, boolean caseSensitive) throws SqlDynaException
createDynaBeanFor(Table) and
findTable(String, boolean).tableName - The name of the table to create the bean forcaseSensitive - Whether case matters for the namesSqlDynaExceptionpublic Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionpublic String toVerboseString()
Copyright © 2005-2013 Apache Software Foundation. All Rights Reserved.