use of javax.enterprise.inject.spi.Bean in project AngularBeans by bessemHmidi.
the class NGSessionScopeContext method get.
@Override
public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {
if (holder.get() == null)
return null;
Bean bean = (Bean) contextual;
if (holder.get().getBeans().containsKey(bean.getBeanClass())) {
return (T) holder.get().getBean(bean.getBeanClass()).instance;
} else {
T instance = (T) bean.create(creationalContext);
NGSessionScopeInstance customInstance = new NGSessionScopeInstance();
customInstance.bean = bean;
customInstance.ctx = creationalContext;
customInstance.instance = instance;
holder.get().putBean(customInstance);
return instance;
}
}
Aggregations