@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.Class<T> beanType,
java.lang.Object... args)
Returns an instance of prototype bean, specifying explicit constructor arguments.
|
<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)
BeanLocatorNAME, this name is used to look up the
bean to improve performance.get in interface BeanLocatorbeanType - type the bean must match; can be an interface or superclass. null is disallowed.public <T> T get(java.lang.String name)
BeanLocatorget in interface BeanLocatorname - 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)
BeanLocatorget in interface BeanLocatorname - 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)
BeanLocatorgetPrototype in interface BeanLocatorname - the name of the bean to retrieveargs - constructor argumentspublic <T> T getPrototype(java.lang.Class<T> beanType,
java.lang.Object... args)
BeanLocatorgetPrototype in interface BeanLocatorbeanType - type the bean must match; can be an interface or superclass. null is disallowed.args - constructor argumentspublic <T> java.util.Map<java.lang.String,T> getAll(java.lang.Class<T> beanType)
BeanLocatorThe 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 BeanLocatorbeanType - the class or interface to match, or null for all concrete beanspublic boolean containsBean(java.lang.String name)
BeanLocatorcontainsBean in interface BeanLocatorpublic void setApplicationContext(@Nonnull
org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansException