org.apache.ddlutils.dynabean
Class DynaClassCache

java.lang.Object
  extended by org.apache.ddlutils.dynabean.DynaClassCache

public class DynaClassCache
extends Object

Provides a cache of dyna class instances for a specific model, as well as helper methods for dealing with these classes.

Version:
$Revision: 231110 $

Constructor Summary
DynaClassCache()
           
 
Method Summary
 DynaBean copy(Table table, Object source)
          Creates a new dyna bean instance for the given table and copies the values from the given source object.
 DynaBean createNewInstance(Table table)
          Creates a new dyna bean instance for the given table.
 SqlDynaClass getDynaClass(DynaBean dynaBean)
          Returns the SqlDynaClass for the given bean.
 SqlDynaClass getDynaClass(Table table)
          Returns the SqlDynaClass for the given table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynaClassCache

public DynaClassCache()
Method Detail

createNewInstance

public DynaBean createNewInstance(Table table)
                           throws SqlDynaException
Creates a new dyna bean instance for the given table.

Parameters:
table - The table
Returns:
The new empty dyna bean
Throws:
SqlDynaException

copy

public DynaBean copy(Table table,
                     Object source)
              throws SqlDynaException
Creates a new dyna bean instance for the given table and copies the values from the given source object. The source object can be a bean, a map or a dyna bean. This method is useful when iterating through an arbitrary dyna bean result set after performing a query, then creating a copy as a DynaBean which is bound to a specific table. This new DynaBean can be kept around, changed and stored back into the database.

Parameters:
table - The table to create the dyna bean for
source - Either a bean, a Map or a dyna bean that will be used to populate the resultint dyna bean
Returns:
A new dyna bean bound to the given table and containing all the properties from the source object
Throws:
SqlDynaException

getDynaClass

public SqlDynaClass getDynaClass(Table table)
Returns the SqlDynaClass for the given table. If the it does not exist yet, a new one will be created based on the Table definition.

Parameters:
table - The table
Returns:
The SqlDynaClass for the indicated table

getDynaClass

public SqlDynaClass getDynaClass(DynaBean dynaBean)
                          throws SqlDynaException
Returns the SqlDynaClass for the given bean.

Parameters:
dynaBean - The bean
Returns:
The dyna bean class
Throws:
SqlDynaException


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.