1. 29 Jan, 2016 1 commit
  2. 28 Jan, 2016 1 commit
    • serso's avatar
      equals() and hashCode() for generated EventHandlers · e65aa65b
      serso authored
      As Otto library uses EventHandler's equals() and hashCode() methods, they should be
      implemented. For anonymous classes it's enough to check class names as each anonymous
      class will get a unique name. However, subscribers of the same type might be
      registered several times and additional "subscribers equal" check should be used.
      
      As Otto Compiler is a compile-time dependency GeneratedEventHandler must be written to
      the output during a round of annotation processing.
      e65aa65b
  3. 26 Jan, 2016 2 commits
    • serso's avatar
      Otto Bus annotation processor · a7df5ddf
      serso authored
      Initial commit containing draft implementation of annotation processor.
      The processor generates a class which implements HandlerFinder
      interface and returns event handlers in a constant time.
      Currently, this file has the following structure:
      
        public Map findAllSubscribers(final Object listener) {
          if (listener.getClass().equals(SomeClass1.class)) {
            final Map<Class<?>, Set<EventHandler>> handlers = new HashMap<Class<?>, Set<EventHandler>>(3);
            handlers.put(Event1.class, Collections.<EventHandler>singleton(
                new BaseEventHandler(){public void handleEvent(Object event){((SomeClass1)listener).onEvent1((Event1)event);}}));
            handlers.put(Event2.class, Collections.<EventHandler>singleton(
                new BaseEventHandler(){public void handleEvent(Object event){((SomeClass1)listener).onEvent2((Event2)event);}}));
            handlers.put(Event3.class, Collections.<EventHandler>singleton(
                new BaseEventHandler(){public void handleEvent(Object event){((SomeClass1)listener).onEvent3((Event3)event);}}));
            return handlers;
          }
      
          if (listener.getClass().equals(SomeClass2.class)) {
            final Map<Class<?>, Set<EventHandler>> handlers = new HashMap<Class<?>, Set<EventHandler>>(1);
            handlers.put(Event1.class, Collections.<EventHandler>singleton(
                new BaseEventHandler(){public void handleEvent(Object event){((SomeClass2)listener).onEvent1((Event1)event);}}));
            return handlers;
          }
      
          // etc
      
          throw new IllegalArgumentException();
        }
      a7df5ddf
    • serso's avatar
      Prepare Otto Bus to another implementation of HandlerFinder · fff705a3
      serso authored
      Bus class shouldn't depend on specific implementation of HandlerFinder/EventHandler.
      Thus:
      1. EventHandler has been converted to an interface
      2. Bus constructors now accept HandlerFinder parameter
      3. EventHandler API has changed a bit (instead of InvocationTargetException a RuntimeException should be thrown)
      fff705a3
  4. 20 Jan, 2016 1 commit
  5. 16 Jan, 2016 2 commits
  6. 27 Oct, 2015 2 commits
  7. 17 Jun, 2015 3 commits
  8. 16 Jun, 2015 1 commit
  9. 08 May, 2015 3 commits
  10. 07 May, 2015 1 commit
  11. 20 Jan, 2015 4 commits
  12. 19 Jan, 2015 2 commits
  13. 20 Dec, 2014 3 commits
  14. 19 Nov, 2014 2 commits
  15. 10 Jun, 2014 5 commits
  16. 09 Jun, 2014 3 commits
  17. 12 May, 2014 2 commits
  18. 03 Mar, 2014 1 commit
  19. 02 Mar, 2014 1 commit