throwBeanIdIsMissing(bean);
}
this.checkIdIsUnique(bean);
final String className = bean.getTypeName();
final Type beanType = this.getConcreteType(beanName, className);
bean.setType(beanType);
context.debug(beanType.getName());
final boolean singleton = bean.isSingleton();
bean.setSingleton(singleton);
context.debug(singleton ? "singleton" : "prototype");
// process the eager/lazy attribute
final boolean eager = bean.isEagerLoaded();
bean.setEagerLoaded(eager);
this.checkPrototypesAreNotMarkedAsEager(bean);
if (singleton) {
context.debug(eager ? "eager" : "lazyloaded");
}
if (false == singleton) {
final String destroyMethod = bean.getDestroyMethod();
if (false == Tester.isNullOrEmpty(destroyMethod)) {
throwPrototypeCantBeContainerDestroyed(bean);
}
final Type disposableBean = this.getDisposableBean();
if (beanType.isAssignableTo(disposableBean)) {
context.warn("Ignoring the fact the bean implements DisposableBean (because its a prototype)"
+ (context.isDebugEnabled() ? "." : ", bean: " + bean));
}
}
// start creating the factory bean...
final Type superType = singleton ? this.getSingletonFactoryBean() : this.getPrototypeFactoryBean();
final NewConcreteType beanFactory = this.getBeanFactory();
final NewNestedType factoryBean = beanFactory.newNestedType();
factoryBean.setStatic(false);
factoryBean.setNestedName(this.escapeBeanIdToBeClassNameSafe(beanName) + Constants.FACTORY_BEAN_SUFFIX);
factoryBean.setSuperType(superType);