/** * Returns a new collection of {@link EventListener} instances, each instance corresponding to an annotated * method discovered on the specified {@code instance} argument. * * @param instance the instance to inspect for annotated event handler methods. * @return a new collection of {@link EventListener} instances, each instance corresponding to an annotated * method discovered on the specified {@code instance} argument. */ public List<EventListener> getEventListeners(Object instance) { if (instance == null) { return Collections.emptyList(); } List<Method> methods = ClassUtils.getAnnotatedMethods(instance.getClass(), getAnnotationClass()); if (methods == null || methods.isEmpty()) { return Collections.emptyList(); } List<EventListener> listeners = new ArrayList<EventListener>(methods.size()); for (Method m : methods) { listeners.add(new SingleArgumentMethodEventListener(instance, m)); } return listeners; }