Hi EJB3 Folks,
is the construction of the ejb reference right in the following code?
This is request for review ;)
package org.jboss.wsf.container.jboss50.deployment.metadata;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import javax.ejb.EJB;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.ejb3.common.resolvers.plugins.FirstMatchEjbReferenceResolver;
import org.jboss.ejb3.common.resolvers.spi.EjbReference;
import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
import org.jboss.wsf.common.javax.resolvers.AbstractReferenceResolver;
final class EjbBeanReferenceResolver
extends AbstractReferenceResolver
{
private final DeploymentUnit unit;
private final EjbReferenceResolver delegate = new FirstMatchEjbReferenceResolver();
EjbBeanReferenceResolver(final DeploymentUnit unit)
{
super(EJB.class);
this.unit = unit;
}
@Override
protected String resolveField(final Field field)
{
EJB ejbAnnotation = field.getAnnotation(EJB.class);
EjbReference reference = getEjbReference(ejbAnnotation, field.getType());
return this.delegate.resolveEjb(unit, reference);
}
@Override
protected String resolveMethod(final Method method)
{
EJB ejbAnnotation = method.getAnnotation(EJB.class);
EjbReference reference = getEjbReference(ejbAnnotation,
method.getParameterTypes()[0]);
return this.delegate.resolveEjb(unit, reference);
}
private EjbReference getEjbReference(EJB ejbAnnotation, Class<?> type)
{
String beanInterface = ejbAnnotation.beanInterface().getName();
if ("".equals(beanInterface))
{
beanInterface = type.getName();
}
return new EjbReference(ejbAnnotation.beanName(), beanInterface,
ejbAnnotation.mappedName());
}
}
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4228320#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...