public void register(final Object object) { final Class clazz = object.getClass(); final String clazzName = clazz.getName(); if (getClasses().containsKey(clazzName)) { System.out.println("Class already registered on eventbus: " + clazzName); } else { System.out.println("Registering Class on eventbus: " + clazz.getName()); try { eventBus.register(object); } catch (final EventBusException e) { } getClasses().put(clazzName, clazz); } }
protected SubscriberMethod createSubscriberMethod(String methodName, Class<?> eventType, ThreadMode threadMode, int priority, boolean sticky) { try { Method method = subscriberClass.getDeclaredMethod(methodName, eventType); return new SubscriberMethod(method, eventType, threadMode, priority, sticky); } catch (NoSuchMethodException e) { throw new EventBusException("Could not find subscriber method in " + subscriberClass + ". Maybe a missing ProGuard rule?", e); } }
public static void register(EventBus bus, Object listener) { try { bus.register(listener); } catch (EventBusException e) { LogHelper.w(TAG, e); } }
public static void unregister(EventBus bus, Object listener) { try { bus.unregister(listener); } catch (EventBusException e) { LogHelper.w(TAG, e); } }