ch.elca.el4j.services.persistence.generic.dao.impl
Class FallbackDaoRegistry

java.lang.Object
  extended by ch.elca.el4j.services.persistence.generic.dao.impl.DefaultDaoRegistry
      extended by ch.elca.el4j.services.persistence.generic.dao.impl.FallbackDaoRegistry
All Implemented Interfaces:
ModuleApplicationListener, DaoRegistry, EventListener, ApplicationContextAware

public class FallbackDaoRegistry
extends DefaultDaoRegistry

This class extends the DefaultDaoRegistry with a fallback function: If no DAO can be found for an entityType, a generic DAO is created.

Author:
Stefan Wismer (SWI)
File-location:
FallbackDaoRegistry
Last check-in date:
2010-01-06 10:07:00 +0100 (Mi, 06. Jan 2010) by jonasha for revision 4071

Field Summary
protected  String m_daoPrototypeBeanName
          The bean name of the fallback DAO prototype.
 
Fields inherited from class ch.elca.el4j.services.persistence.generic.dao.impl.DefaultDaoRegistry
m_applicationContext, m_applicationContextIsReady, m_beanClassDaos, m_collectDaos, m_creatorThreadId, m_daoClassDaos, m_daoNamePattern, m_initialized
 
Constructor Summary
FallbackDaoRegistry()
           
 
Method Summary
protected
<T> GenericDao<T>
createFor(Class<T> entityType)
           
 String getDaoPrototypeBeanName()
           
<T> GenericDao<T>
getFor(Class<T> entityType)
          Returns the generic DAO for entities of type entityType.
 void setDaoPrototypeBeanName(String daoPrototypeBeanName)
           
 
Methods inherited from class ch.elca.el4j.services.persistence.generic.dao.impl.DefaultDaoRegistry
getDao, getDaos, initDao, initDaosFromSpringBeans, isCollectDaos, onContextRefreshed, setApplicationContext, setCollectDaos, setDaos, setNamePattern, waitUntilApplicationContextIsReady
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_daoPrototypeBeanName

protected String m_daoPrototypeBeanName
The bean name of the fallback DAO prototype.

Constructor Detail

FallbackDaoRegistry

public FallbackDaoRegistry()
Method Detail

getFor

public <T> GenericDao<T> getFor(Class<T> entityType)
Returns the generic DAO for entities of type entityType.

Specified by:
getFor in interface DaoRegistry
Overrides:
getFor in class DefaultDaoRegistry
Type Parameters:
T - The domain class type.
Parameters:
entityType - The domain class for which a generic DAO should be returned. The class does some basic handling to tolerate (i.e. unwrap) Spring proxies.
Returns:
A fully generic or partially specific DAO for the given type, or null if none was found.

createFor

protected <T> GenericDao<T> createFor(Class<T> entityType)
Type Parameters:
T - The class of entityType
Parameters:
entityType - The domain class for which a generic DAO should be returned.
Returns:
A new generic DAO for this entityType

getDaoPrototypeBeanName

public String getDaoPrototypeBeanName()
Returns:
The bean name of the fallback DAO prototype.

setDaoPrototypeBeanName

public void setDaoPrototypeBeanName(String daoPrototypeBeanName)
Parameters:
daoPrototypeBeanName - The bean name of the fallback DAO prototype.


Copyright © 2005-2011 ELCA. All Rights Reserved.