SRJRCFrames
v0.1.296

de.schwarzrot.data.access.support
Class EntityUtils

java.lang.Object
  extended by de.schwarzrot.data.access.support.EntityUtils

public class EntityUtils
extends Object

helper class for anonymous entity handling. Existing implementations are not robust enuf to handle null values, so I had to write my own bean handling. This class also handles the creation of derived entities, where several classes share a single database table.

Author:
Reinhard Mantey

Constructor Summary
EntityUtils()
           
 
Method Summary
<E extends Entity>
void
copyProperties(E dest, E src, EntityDescriptor ed, String[] propertyNames)
           
<E extends Entity>
E
createEntity(EntityDescriptor ed, DataAccessor da, EntityIntrospector ei)
          create an entity from a resultset.
 void fillEntity(Entity entity, EntityDescriptor ed, DataAccessor da, EntityIntrospector ei)
          fills an entity instance from a resultset
 void fillEntity(Entity entity, String[] propertyNames, EntityDescriptor ed, DataAccessor da, EntityIntrospector ei)
          fills given properties of the entity from a resultset
 ConverterFactory getConverterFactory()
           
 EntityHolder getEntityCache()
           
 void setConverterFactory(ConverterFactory converterFactory)
           
 void setEntityCache(EntityHolder entityCache)
           
protected
<E extends Entity>
void
setProperty(E instance, String propertyName, EntityDescriptor ed, DataAccessor da)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityUtils

public EntityUtils()
Method Detail

copyProperties

public <E extends Entity> void copyProperties(E dest,
                                              E src,
                                              EntityDescriptor ed,
                                              String[] propertyNames)

createEntity

public <E extends Entity> E createEntity(EntityDescriptor ed,
                                         DataAccessor da,
                                         EntityIntrospector ei)
                              throws ClassNotFoundException,
                                     InstantiationException,
                                     IllegalAccessException
create an entity from a resultset.

Type Parameters:
E - the entity to create
Parameters:
ed - the descriptor for the involved entity
da - a wrapper to access data in a general fashion
ei - the entity introspector
Returns:
the newly created and populated entity instance
Throws:
ClassNotFoundException - - raise Exception from underlying layer to application
InstantiationException - - raise Exception from underlying layer to application
IllegalAccessException - - raise Exception from underlying layer to application

fillEntity

public void fillEntity(Entity entity,
                       EntityDescriptor ed,
                       DataAccessor da,
                       EntityIntrospector ei)
fills an entity instance from a resultset

Parameters:
entity - the entity to fill with data from resultset
ed - the entity descriptor
da - a wrapper to access data in a general fashion
ei - the entity introspector

fillEntity

public void fillEntity(Entity entity,
                       String[] propertyNames,
                       EntityDescriptor ed,
                       DataAccessor da,
                       EntityIntrospector ei)
fills given properties of the entity from a resultset

Parameters:
entity - the entity to fill with data from resultset
propertyNames - fill only given property names
ed - the entity descriptor
da - a wrapper to access data in a general fashion
ei - the entity introspector

getConverterFactory

public final ConverterFactory getConverterFactory()

getEntityCache

public final EntityHolder getEntityCache()

setConverterFactory

public final void setConverterFactory(ConverterFactory converterFactory)

setEntityCache

public final void setEntityCache(EntityHolder entityCache)

setProperty

protected <E extends Entity> void setProperty(E instance,
                                              String propertyName,
                                              EntityDescriptor ed,
                                              DataAccessor da)

SRJRCFrames
v0.1.296

hosted at
Find SRJRCFrames at SourceForge.net. Fast, secure and free:
           Open Source Software download
Submit a bug or request a feature

SRJRCFrames is published according to the GNU General Public License
Copyright 2005-2012 Reinhard Mantey - some rights reserved.