use of org.hibernate.resource.beans.container.spi.FallbackContainedBean in project hibernate-orm by hibernate.
the class ManagedBeanRegistryImpl method getBean.
@Override
@SuppressWarnings("unchecked")
public <T> ManagedBean<T> getBean(Class<T> beanClass) {
final ManagedBean existing = registrations.get(beanClass.getName());
if (existing != null) {
return existing;
}
final ManagedBean bean;
if (beanContainer == null) {
bean = new FallbackContainedBean(beanClass, FallbackBeanInstanceProducer.INSTANCE);
} else {
final ContainedBean<T> containedBean = beanContainer.getBean(beanClass, this, FallbackBeanInstanceProducer.INSTANCE);
if (containedBean instanceof ManagedBean) {
bean = (ManagedBean) containedBean;
} else {
bean = new ContainedBeanManagedBeanAdapter(beanClass, containedBean);
}
}
registrations.put(beanClass.getName(), bean);
return bean;
}
use of org.hibernate.resource.beans.container.spi.FallbackContainedBean in project hibernate-orm by hibernate.
the class ManagedBeanRegistryImpl method getBean.
@Override
@SuppressWarnings("unchecked")
public <T> ManagedBean<T> getBean(String beanName, Class<T> beanContract) {
final String key = beanContract.getName() + ':' + beanName;
final ManagedBean existing = registrations.get(key);
if (existing != null) {
return existing;
}
final ManagedBean bean;
if (beanContainer == null) {
bean = new FallbackContainedBean(beanName, beanContract, FallbackBeanInstanceProducer.INSTANCE);
} else {
final ContainedBean<T> containedBean = beanContainer.getBean(beanName, beanContract, this, FallbackBeanInstanceProducer.INSTANCE);
if (containedBean instanceof ManagedBean) {
bean = (ManagedBean) containedBean;
} else {
bean = new ContainedBeanManagedBeanAdapter(beanContract, containedBean);
}
}
registrations.put(key, bean);
return bean;
}
Aggregations