use of javax.ejb.Remove in project tomee by apache.
the class CdiEjbBean method findRemove.
private List<Method> findRemove(final Class<?> beanClass, final Class<?> beanInterface) {
final List<Method> toReturn = new ArrayList<>();
// Get all the public methods of the bean class and super class
final Method[] methods = beanClass.getMethods();
// Search for methods annotated with @Remove
for (final Method method : methods) {
final Remove annotation = method.getAnnotation(Remove.class);
if (annotation != null) {
// Get the corresponding method into the bean interface
final Method interfaceMethod;
try {
interfaceMethod = beanInterface.getMethod(method.getName(), method.getParameterTypes());
toReturn.add(interfaceMethod);
} catch (final SecurityException e) {
e.printStackTrace();
} catch (final NoSuchMethodException e) {
// The method can not be into the interface in which case we
// don't wonder of
}
}
}
return toReturn;
}
use of javax.ejb.Remove in project Payara by payara.
the class RemoveHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
Remove remove = (Remove) ainfo.getAnnotation();
for (EjbContext next : ejbContexts) {
EjbSessionDescriptor sessionDescriptor = (EjbSessionDescriptor) next.getDescriptor();
Method m = (Method) ainfo.getAnnotatedElement();
MethodDescriptor removeMethod = new MethodDescriptor(m, MethodDescriptor.EJB_BEAN);
EjbRemovalInfo removalInfo = sessionDescriptor.getRemovalInfo(removeMethod);
if (removalInfo == null) {
// if this element is not defined in xml
// use all information from annotation
removalInfo = new EjbRemovalInfo();
removalInfo.setRemoveMethod(removeMethod);
removalInfo.setRetainIfException(remove.retainIfException());
sessionDescriptor.addRemoveMethod(removalInfo);
} else {
// is not defined in xml
if (!removalInfo.isRetainIfExceptionSet()) {
removalInfo.setRetainIfException(remove.retainIfException());
}
}
}
return getDefaultProcessedResult();
}
Aggregations