// Possibly study alternatives. Alternatives might have different meta data completely while it seems Specializing beans inherit all meta-data
// Anyway.. the qualifiers aren't getting inherited, so we need to fix that
for (final Annotated<Class<?>> beanClass : finder.findMetaAnnotatedClasses(Stateful.class)) {
final Stateful stateful = beanClass.getAnnotation(Stateful.class);
final String ejbName = getEjbName(stateful, beanClass.get());
if (!isValidEjbAnnotationUsage(Stateful.class, beanClass, ejbName, ejbModule)) {
continue;
}
EnterpriseBean enterpriseBean = ejbJar.getEnterpriseBean(ejbName);
if (enterpriseBean == null) {
enterpriseBean = new StatefulBean(ejbName, beanClass.get());
ejbJar.addEnterpriseBean(enterpriseBean);
}
if (enterpriseBean.getEjbClass() == null) {
enterpriseBean.setEjbClass(beanClass.get());
}
if (enterpriseBean instanceof SessionBean) {
final SessionBean sessionBean = (SessionBean) enterpriseBean;
// TODO: We might be stepping on an xml override here
sessionBean.setSessionType(SessionType.STATEFUL);
if (stateful.mappedName() != null) {
sessionBean.setMappedName(stateful.mappedName());
}
if (sessionBean.getPassivationCapable() == null) {
sessionBean.setPassivationCapable(stateful.passivationCapable());
}
}
LegacyProcessor.process(beanClass.get(), enterpriseBean);
}