|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.ddlutils.model.Database
Represents the database model, ie. the tables in the database. It also contains the corresponding dyna classes for creating dyna beans for the objects stored in the tables.
Constructor Summary | |
Database()
|
Method Summary | |
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()
|
DynaBean |
createDynaBeanFor(String tableName,
boolean caseSensitive)
Convenience method that combines createDynaBeanFor(Table) and
findTable(String, boolean) . |
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(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 |
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. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Database()
Method Detail |
public void mergeWith(Database otherDb) throws DynaSqlException
otherDb
- The other database model
DynaSqlException
public 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 table
public 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
ModelException
public Table findTable(String name)
name
- The name of the table to find
null
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 names
null
if there is no such tablepublic 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 for
SqlDynaClass
for the indicated table or null
if the model contains no such tablepublic SqlDynaClass getDynaClassFor(DynaBean bean)
SqlDynaClass
for the given dyna bean.
bean
- The dyna bean
SqlDynaClass
for the given beanpublic DynaBean createDynaBeanFor(Table table) throws DynaSqlException
table
- The table to create the bean for
DynaSqlException
public DynaBean createDynaBeanFor(String tableName, boolean caseSensitive) throws DynaSqlException
createDynaBeanFor(Table)
and
findTable(String, boolean)
.
tableName
- The name of the table to create the bean forcaseSensitive
- Whether case matters for the names
DynaSqlException
public Object clone() throws CloneNotSupportedException
CloneNotSupportedException
public boolean equals(Object obj)
public int hashCode()
public String toString()
public String toVerboseString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |