|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.alfresco.util.bean.HierarchicalBeanLoader
public class HierarchicalBeanLoader
Factory bean to find beans using a class hierarchy to drive the lookup. The well-known
placeholder HierarchicalBeanLoader.DEFAULT_DIALECT_PLACEHOLDER is replaced with successive class
names starting from the dialect class and
progressing up the hierarchy until the base class
is reached. The bean is looked up in the context at each point until the
bean is found or the base of the class hierarchy is reached.
BEAN 1: contentDAO.org.hibernate.dialect.Dialect
BEAN 2: contentDAO.org.hibernate.dialect.MySQLInnoDBDialect
BEAN 3: propertyValueDAO.org.hibernate.dialect.Dialect
BEAN 4: propertyValueDAO.org.hibernate.dialect.MySQLDialect
and
dialectBaseClass = org.hibernate.dialect.Dialect
For dialect org.hibernate.dialect.MySQLInnoDBDialect the following will be returned:
contentDAO.bean.dialect == BEAN 2
propertyValueDAO.bean.dialect == BEAN 4
For dialectorg.hibernate.dialect.MySQLDBDialect the following will be returned:
contentDAO.bean.dialect == BEAN 1
propertyValueDAO.bean.dialect == BEAN 4
For dialectorg.hibernate.dialect.Dialect the following will be returned:
contentDAO.bean.dialect == BEAN 1
propertyValueDAO.bean.dialect == BEAN 3
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_DIALECT_PLACEHOLDER
|
static java.lang.String |
DEFAULT_DIALECT_REGEX
|
| Constructor Summary | |
|---|---|
HierarchicalBeanLoader()
Create a new HierarchicalResourceLoader. |
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
|
java.lang.Object |
getObject()
Replaces the |
java.lang.Class |
getObjectType()
|
boolean |
isSingleton()
|
void |
setApplicationContext(org.springframework.context.ApplicationContext ctx)
The application context that this bean factory serves. |
void |
setDialectBaseClass(java.lang.String className)
Set the class to be used during hierarchical dialect replacement. |
void |
setDialectClass(java.lang.String className)
|
void |
setTargetBeanName(java.lang.String targetBeanName)
|
void |
setTargetClass(java.lang.Class targetClass)
Set the target class that will be returned by HierarchicalBeanLoader.getObjectType() |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_DIALECT_PLACEHOLDER
public static final java.lang.String DEFAULT_DIALECT_REGEX
| Constructor Detail |
|---|
public HierarchicalBeanLoader()
| Method Detail |
|---|
public void setApplicationContext(org.springframework.context.ApplicationContext ctx)
setApplicationContext in interface org.springframework.context.ApplicationContextAwarepublic void setTargetBeanName(java.lang.String targetBeanName)
targetBeanName - the name of the target bean to return,
including the HierarchicalBeanLoader.DEFAULT_DIALECT_PLACEHOLDER
where the specific dialect must be replaced.public void setTargetClass(java.lang.Class targetClass)
HierarchicalBeanLoader.getObjectType()
targetClass - the type that this factory returnspublic void setDialectBaseClass(java.lang.String className)
className - the name of the class or interfacepublic void setDialectClass(java.lang.String className)
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionpublic java.lang.Class getObjectType()
getObjectType in interface org.springframework.beans.factory.FactoryBeantarget classpublic boolean isSingleton()
isSingleton in interface org.springframework.beans.factory.FactoryBean
public java.lang.Object getObject()
throws java.lang.Exception
getObject in interface org.springframework.beans.factory.FactoryBeanjava.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||