if (allInterfaces.contains(SESSION_BEAN_INTERFACE)) {
// first add dependency injection for setSessionContext method.
JAnnotationResource jAnnotationResource = new JAnnotationResource();
// add resource on setSessionContext method
EasyBeansEjbJarMethodMetadata setCtxMethod = getMethod(sessionBean, SETSESSIONCONTEXT_METHOD, false,
SESSION_BEAN_INTERFACE);
setCtxMethod.setJAnnotationResource(jAnnotationResource);
// ejbRemove() method
EasyBeansEjbJarMethodMetadata ejbRemoveMethod = getMethod(sessionBean, EJBREMOVE_METHOD, true, SESSION_BEAN_INTERFACE);
ejbRemoveMethod.setPreDestroy(true);
if (!sessionBean.getPreDestroyMethodsMetadata().contains(ejbRemoveMethod)) {
sessionBean.addPreDestroyMethodMetadata(ejbRemoveMethod);
}
// ejbActivate() method
EasyBeansEjbJarMethodMetadata ejbActivateMethod = getMethod(sessionBean, EJBACTIVATE_METHOD, true, SESSION_BEAN_INTERFACE);
ejbRemoveMethod.setPostActivate(true);
if (!sessionBean.getPostActivateMethodsMetadata().contains(ejbActivateMethod)) {
sessionBean.addPostActivateMethodMetadata(ejbActivateMethod);
}
// ejbPassivate() method
EasyBeansEjbJarMethodMetadata ejbPassivateMethod = getMethod(sessionBean, EJBPASSIVATE_METHOD, true,
SESSION_BEAN_INTERFACE);
ejbRemoveMethod.setPrePassivate(true);
if (!sessionBean.getPrePassivateMethodsMetadata().contains(ejbPassivateMethod)) {
sessionBean.addPrePassivateMethodMetadata(ejbPassivateMethod);
}