|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjfun.yan.spring.Container2ApplicationContext
public class Container2ApplicationContext
This class adapts a yan Container object to Spring's ApplicationContext (primarily ListableBeanFactory) interface.
Many Thanks to spring for making ApplicationContext an interface! It helped.
| Field Summary |
|---|
| Fields inherited from interface org.springframework.beans.factory.BeanFactory |
|---|
FACTORY_BEAN_PREFIX |
| Fields inherited from interface org.springframework.beans.factory.BeanFactory |
|---|
FACTORY_BEAN_PREFIX |
| Fields inherited from interface org.springframework.beans.factory.BeanFactory |
|---|
FACTORY_BEAN_PREFIX |
| Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver |
|---|
CLASSPATH_URL_PREFIX |
| Constructor Summary | |
|---|---|
Container2ApplicationContext(org.springframework.context.MessageSource message_source,
org.springframework.core.io.support.ResourcePatternResolver resource_loader,
org.springframework.context.ApplicationEventPublisher publisher,
java.lang.String name,
long startup_timestamp,
Container yan)
Create a Container2BeanFactory object. |
|
| Method Summary | |
|---|---|
boolean |
containsBean(java.lang.String name)
Same as containsBeanDefinition(String) since
this class does not care about hierarchy. |
boolean |
containsBeanDefinition(java.lang.String beanName)
|
java.lang.String[] |
getAliases(java.lang.String name)
Always returns empty. |
java.lang.Object |
getBean(java.lang.String name)
Get a bean object. |
java.lang.Object |
getBean(java.lang.String beanname,
java.lang.Class requiredType)
Get a bean object. |
int |
getBeanDefinitionCount()
Get the number of components registered under a string key. |
java.lang.String[] |
getBeanDefinitionNames()
Get all the component keys that are of String type. |
java.lang.String[] |
getBeanDefinitionNames(java.lang.Class type)
retrieves the string keys of all components whose's static instance type is a subtype of the required type. |
java.lang.String[] |
getBeanNamesForType(java.lang.Class type)
retrieves the string keys of all components whose's static instance type is a subtype of the required type. |
java.lang.String[] |
getBeanNamesForType(java.lang.Class type,
boolean includePrototypes,
boolean includeFactoryBeans)
|
java.util.Map |
getBeansOfType(java.lang.Class type)
Get the (String,Object) map of all components with the given type. |
java.util.Map |
getBeansOfType(java.lang.Class type,
boolean includePrototypes,
boolean includeFactoryBeans)
Get the (String,Object) map of all components with the given type. |
Container |
getContainer()
Get the container in this object. |
java.lang.String |
getDisplayName()
|
java.lang.String |
getMessage(org.springframework.context.MessageSourceResolvable resolvable,
java.util.Locale locale)
|
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args,
java.util.Locale locale)
|
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args,
java.lang.String defaultMessage,
java.util.Locale locale)
|
org.springframework.context.ApplicationContext |
getParent()
|
org.springframework.beans.factory.BeanFactory |
getParentBeanFactory()
|
org.springframework.core.io.Resource |
getResource(java.lang.String location)
|
org.springframework.core.io.Resource[] |
getResources(java.lang.String locationPattern)
|
long |
getStartupDate()
|
java.lang.Class |
getType(java.lang.String name)
Get the static type of a component identified by the name. |
boolean |
isSingleton(java.lang.String name)
Is the component identified by the name a singleton? FactoryBean is instantiated if the name doesn't start with '&' and the bean is a FactoryBean. |
void |
publishEvent(org.springframework.context.ApplicationEvent event)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Container2ApplicationContext(org.springframework.context.MessageSource message_source,
org.springframework.core.io.support.ResourcePatternResolver resource_loader,
org.springframework.context.ApplicationEventPublisher publisher,
java.lang.String name,
long startup_timestamp,
Container yan)
message_source - the MessageSource object.resource_loader - the ResourcePatternResolver object.publisher - the ApplicationEventPublisher object.name - the name of the ApplicationContext.startup_timestamp - the startup timestamp.yan - the yan Container object.| Method Detail |
|---|
public Container getContainer()
public int getBeanDefinitionCount()
getBeanDefinitionCount in interface org.springframework.beans.factory.ListableBeanFactorypublic java.lang.String[] getBeanDefinitionNames()
getBeanDefinitionNames in interface org.springframework.beans.factory.ListableBeanFactorypublic java.lang.String[] getBeanDefinitionNames(java.lang.Class type)
FactoryBean's are not instantiated.
getBeanDefinitionNames in interface org.springframework.beans.factory.ListableBeanFactorytype - the type to match. Null indicates all.
public java.lang.String[] getBeanNamesForType(java.lang.Class type)
FactoryBean's are instantiated if necessary to find out the product type.
type - the type to match. Null indicates all.
public java.lang.String[] getBeanNamesForType(java.lang.Class type,
boolean includePrototypes,
boolean includeFactoryBeans)
public boolean containsBeanDefinition(java.lang.String beanName)
containsBeanDefinition in interface org.springframework.beans.factory.ListableBeanFactory
public java.util.Map getBeansOfType(java.lang.Class type)
throws org.springframework.beans.BeansException
getBeansOfType in interface org.springframework.beans.factory.ListableBeanFactorytype - the expected type. If this type is FactoryBean,
the component is adapted to FactoryBean without actually instantiating
instance.
org.springframework.beans.BeansException
public java.util.Map getBeansOfType(java.lang.Class type,
boolean includePrototypes,
boolean includeFactoryBeans)
throws org.springframework.beans.BeansException
getBeansOfType in interface org.springframework.beans.factory.ListableBeanFactorytype - the expected type.includePrototypes - Are the components who may not be singletons included?includeFactoryBeans - Are FactoryBean objects included?
org.springframework.beans.BeansException
public java.lang.Object getBean(java.lang.String name)
throws org.springframework.beans.BeansException
getBean in interface org.springframework.beans.factory.BeanFactoryname - the name of the component.
If the name starts with a "&", as specified by Spring,
a FactoryBean object is returned corresponding to the component,
otherwise the component itself is instantiated.
org.springframework.beans.BeansException
public java.lang.Object getBean(java.lang.String beanname,
java.lang.Class requiredType)
throws org.springframework.beans.BeansException
getBean in interface org.springframework.beans.factory.BeanFactorybeanname - the name of the component.
If the name starts with a "&", as specified by Spring,
a FactoryBean object is returned corresponding to the component,
otherwise the component itself is instantiated.requiredType - the expecting type. If the name starts with
a "&", as specified by Spring convention, the type has to be
either null or FactoryBean or a super type of FactoryBean.
And in that case, a FactoryBean object is returned.
If the name is a regular bean name, the corresponding component
is instantiated.
org.springframework.beans.BeansExceptionpublic boolean containsBean(java.lang.String name)
containsBeanDefinition(String) since
this class does not care about hierarchy.
In fact, Yan does not create Spring hierarchies.
containsBean in interface org.springframework.beans.factory.BeanFactory
public boolean isSingleton(java.lang.String name)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
isSingleton in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.factory.NoSuchBeanDefinitionException
public java.lang.Class getType(java.lang.String name)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
getType in interface org.springframework.beans.factory.BeanFactoryname - the bean name. FactoryBean is instantiated if
the name doesn't start with '&' and the bean is a FactoryBean.
org.springframework.beans.factory.NoSuchBeanDefinitionException
public java.lang.String[] getAliases(java.lang.String name)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
getAliases in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic java.lang.String getDisplayName()
getDisplayName in interface org.springframework.context.ApplicationContextpublic org.springframework.context.ApplicationContext getParent()
getParent in interface org.springframework.context.ApplicationContextpublic long getStartupDate()
getStartupDate in interface org.springframework.context.ApplicationContextpublic void publishEvent(org.springframework.context.ApplicationEvent event)
publishEvent in interface org.springframework.context.ApplicationContextpublishEvent in interface org.springframework.context.ApplicationEventPublisher
public java.lang.String getMessage(java.lang.String code,
java.lang.Object[] args,
java.util.Locale locale)
throws org.springframework.context.NoSuchMessageException
getMessage in interface org.springframework.context.MessageSourceorg.springframework.context.NoSuchMessageException
public java.lang.String getMessage(org.springframework.context.MessageSourceResolvable resolvable,
java.util.Locale locale)
throws org.springframework.context.NoSuchMessageException
getMessage in interface org.springframework.context.MessageSourceorg.springframework.context.NoSuchMessageException
public java.lang.String getMessage(java.lang.String code,
java.lang.Object[] args,
java.lang.String defaultMessage,
java.util.Locale locale)
getMessage in interface org.springframework.context.MessageSource
public org.springframework.core.io.Resource[] getResources(java.lang.String locationPattern)
throws java.io.IOException
getResources in interface org.springframework.core.io.support.ResourcePatternResolverjava.io.IOExceptionpublic org.springframework.core.io.Resource getResource(java.lang.String location)
getResource in interface org.springframework.core.io.ResourceLoaderpublic org.springframework.beans.factory.BeanFactory getParentBeanFactory()
getParentBeanFactory in interface org.springframework.beans.factory.HierarchicalBeanFactory
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||