}
/* 19.2: ejb-name: Default is the unqualified name of the bean class */
final EjbJar ejbJar = ejbModule.getEjbJar();
for (final Annotated<Class<?>> beanClass : finder.findMetaAnnotatedClasses(Singleton.class)) {
final Singleton singleton = beanClass.getAnnotation(Singleton.class);
final String ejbName = getEjbName(singleton, beanClass.get());
if (!isValidEjbAnnotationUsage(Singleton.class, beanClass, ejbName, ejbModule)) {
continue;
}
EnterpriseBean enterpriseBean = ejbJar.getEnterpriseBean(ejbName);
if (enterpriseBean == null) {
enterpriseBean = new SingletonBean(ejbName, beanClass.get());
ejbJar.addEnterpriseBean(enterpriseBean);
}
if (enterpriseBean.getEjbClass() == null) {
enterpriseBean.setEjbClass(beanClass.get());
}
if (enterpriseBean instanceof SessionBean) {
final SessionBean sessionBean = (SessionBean) enterpriseBean;
sessionBean.setSessionType(SessionType.SINGLETON);
if (singleton.mappedName() != null) {
sessionBean.setMappedName(singleton.mappedName());
}
}
LegacyProcessor.process(beanClass.get(), enterpriseBean);
}