@Component(value="cuba_BeanLocator") public class BeanLocatorImpl extends java.lang.Object implements BeanLocator, org.springframework.context.ApplicationContextAware
NAME
Constructor and Description |
---|
BeanLocatorImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsBean(java.lang.String name)
Whether a bean with the given name is present.
|
<T> T |
get(java.lang.Class<T> beanType)
Returns the bean instance that matches the given object type.
|
<T> T |
get(java.lang.String name)
Return an instance of the specified bean.
|
<T> T |
get(java.lang.String name,
java.lang.Class<T> beanType)
Returns an instance of the specified bean.
|
<T> java.util.Map<java.lang.String,T> |
getAll(java.lang.Class<T> beanType)
Returns the bean instances that match the given object type (including
subclasses).
|
<T> T |
getPrototype(java.lang.String name,
java.lang.Object... args)
Returns an instance of prototype bean, specifying explicit constructor arguments.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
public <T> T get(java.lang.Class<T> beanType)
BeanLocator
NAME
, this name is used to look up the
bean to improve performance.get
in interface BeanLocator
beanType
- type the bean must match; can be an interface or superclass. null
is disallowed.public <T> T get(java.lang.String name)
BeanLocator
get
in interface BeanLocator
name
- the name of the bean to retrieveBeanFactory.getBean(java.lang.String)
public <T> T get(java.lang.String name, @Nullable java.lang.Class<T> beanType)
BeanLocator
get
in interface BeanLocator
name
- the name of the bean to retrievebeanType
- type the bean must match. Can be an interface or superclass of the actual class, or null
for any match. For example, if the value is Object.class, this method will succeed whatever the class of the
returned instance.public <T> T getPrototype(java.lang.String name, java.lang.Object... args)
BeanLocator
getPrototype
in interface BeanLocator
name
- the name of the bean to retrieveargs
- constructor argumentspublic <T> java.util.Map<java.lang.String,T> getAll(java.lang.Class<T> beanType)
BeanLocator
The Map returned by this method should always return bean names and corresponding bean instances in the order of definition in the backend configuration, as far as possible.
getAll
in interface BeanLocator
beanType
- the class or interface to match, or null
for all concrete beanspublic boolean containsBean(java.lang.String name)
BeanLocator
containsBean
in interface BeanLocator
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException