private boolean isEventSubscriber(Object bean) { List annotatedMethods = ClassUtils.getAnnotatedMethods(bean.getClass(), Subscribe.class); return !CollectionUtils.isEmpty(annotatedMethods); }
private boolean isEventSubscriber(Object bean, String name) { List annotatedMethods = ClassUtils.getAnnotatedMethods(bean.getClass(), Subscribe.class); return !isEmpty(annotatedMethods); }
@Override public <I> void hear(TypeLiteral<I> typeLiteral, TypeEncounter<I> typeEncounter) { final Provider<EventBus> eventBusProvider = typeEncounter.getProvider(EventBus.class); List<Method> methods = ClassUtils.getAnnotatedMethods(typeLiteral.getRawType(), Subscribe.class); if (methods != null && !methods.isEmpty()) { typeEncounter.register( new InjectionListener<I>() { @Override public void afterInjection(Object o) { eventBusProvider.get().register(o); } }); } } }
/** * 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; }
private boolean isEventSubscriber(Object bean, String name) { List annotatedMethods = ClassUtils.getAnnotatedMethods(bean.getClass(), Subscribe.class); return !isEmpty(annotatedMethods); }
private boolean isEventSubscriber(Object bean) { List annotatedMethods = ClassUtils.getAnnotatedMethods(bean.getClass(), Subscribe.class); return !CollectionUtils.isEmpty(annotatedMethods); }
@Override public <I> void hear(TypeLiteral<I> typeLiteral, TypeEncounter<I> typeEncounter) { final Provider<EventBus> eventBusProvider = typeEncounter.getProvider(EventBus.class); List<Method> methods = ClassUtils.getAnnotatedMethods(typeLiteral.getRawType(), Subscribe.class); if (methods != null && !methods.isEmpty()) { typeEncounter.register( new InjectionListener<I>() { @Override public void afterInjection(Object o) { eventBusProvider.get().register(o); } }); } } }