private Map<Method, MethodType> getLifecycleMethodsOfInterface(BeanContext beanContext) { Map<Method, MethodType> methods = new HashMap<Method, MethodType>(); List<Method> removeMethods = beanContext.getRemoveMethods(); for (Method removeMethod : removeMethods) { methods.put(removeMethod, MethodType.REMOVE); for (Class businessLocal : beanContext.getBusinessLocalInterfaces()) { try { Method method = businessLocal.getMethod(removeMethod.getName()); methods.put(method, MethodType.REMOVE); } catch (NoSuchMethodException thatsFine) { } } for (Class businessRemote : beanContext.getBusinessRemoteInterfaces()) { try { Method method = businessRemote.getMethod(removeMethod.getName()); methods.put(method, MethodType.REMOVE); } catch (NoSuchMethodException thatsFine) { } } } Class legacyRemote = beanContext.getRemoteInterface(); if (legacyRemote != null) { try { Method method = legacyRemote.getMethod("remove"); methods.put(method, MethodType.REMOVE); } catch (NoSuchMethodException thatsFine) { } } Class legacyLocal = beanContext.getLocalInterface(); if (legacyLocal != null) { try { Method method = legacyLocal.getMethod("remove"); methods.put(method, MethodType.REMOVE); } catch (NoSuchMethodException thatsFine) { } } Class businessLocalHomeInterface = beanContext.getBusinessLocalInterface(); if (businessLocalHomeInterface != null) { for (Method method : BeanContext.BusinessLocalHome.class.getMethods()) { if (method.getName().startsWith("create")) { methods.put(method, MethodType.CREATE); } else if (method.getName().equals("remove")) { methods.put(method, MethodType.REMOVE); } } } Class businessLocalBeanHomeInterface = beanContext.getBusinessLocalBeanInterface(); if (businessLocalBeanHomeInterface != null) { for (Method method : BeanContext.BusinessLocalBeanHome.class.getMethods()) { if (method.getName().startsWith("create")) { methods.put(method, MethodType.CREATE); } else if (method.getName().equals("remove")) { methods.put(method, MethodType.REMOVE); } } } Class businessRemoteHomeInterface = beanContext.getBusinessRemoteInterface(); if (businessRemoteHomeInterface != null) { for (Method method : BeanContext.BusinessRemoteHome.class.getMethods()) { if (method.getName().startsWith("create")) { methods.put(method, MethodType.CREATE); } else if (method.getName().equals("remove")) { methods.put(method, MethodType.REMOVE); } } } Class homeInterface = beanContext.getHomeInterface(); if (homeInterface != null) { for (Method method : homeInterface.getMethods()) { if (method.getName().startsWith("create")) { methods.put(method, MethodType.CREATE); } else if (method.getName().equals("remove")) { methods.put(method, MethodType.REMOVE); } } } Class localHomeInterface = beanContext.getLocalHomeInterface(); if (localHomeInterface != null) { for (Method method : localHomeInterface.getMethods()) { if (method.getName().startsWith("create")) { methods.put(method, MethodType.CREATE); } else if (method.getName().equals("remove")) { methods.put(method, MethodType.REMOVE); } } } return methods; }