use of org.jboss.metadata.ejb.spec.InitMethodsMetaData in project wildfly by wildfly.
the class InitMethodMergingProcessor method handleDeploymentDescriptor.
@Override
protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final StatefulComponentDescription description) throws DeploymentUnitProcessingException {
// first look for old school ejbCreate methods
// we are only looking on the bean class, not sure if that is correct or not
Class<?> clazz = componentClass;
while (clazz != Object.class && clazz != null) {
final ClassReflectionIndex index = deploymentReflectionIndex.getClassIndex(clazz);
for (Method method : (Iterable<Method>) index.getMethods()) {
// it will be overridden below
if (method.getName().startsWith("ejbCreate") && !description.getInitMethods().containsKey(method)) {
description.addInitMethod(method, null);
}
}
clazz = clazz.getSuperclass();
}
SessionBeanMetaData data = description.getDescriptorData();
if (data instanceof SessionBean31MetaData) {
SessionBean31MetaData metaData = (SessionBean31MetaData) data;
final InitMethodsMetaData inits = metaData.getInitMethods();
if (inits != null) {
for (InitMethodMetaData method : inits) {
Method beanMethod = MethodResolutionUtils.resolveMethod(method.getBeanMethod(), componentClass, deploymentReflectionIndex);
if (method.getCreateMethod() != null) {
description.addInitMethod(beanMethod, method.getCreateMethod().getMethodName());
} else {
description.addInitMethod(beanMethod, null);
}
}
}
}
}
Aggregations