Annotation Support
See original GitHub issueHey, this looks like a great library, and I have been exploring using it. I know you guys have quite done quite a bit of research regarding Anotations vs Method Naming, but overall I really feel like Annotations are a much cleaner and more flexible solution.
I added annotations to my local branch. You can create a new EventBus that uses annotations like this new EventBus(DeclarationType.ANNOTATIONS)
. Then you can subscribe to receive events on any method like this:
@Subscribe
public void onMyEvent(CustomEvent e)
This uses the caller chooses thread method. We can also change this by adding an argument.
@Subscribe(threadMode = ThreadMode.Background)
public void onMyEvent(CustomEvent e)
This uses the background thread and is definitely a more explicit syntax.
Here is a link to my repo where I implemented the changes. https://github.com/rjbrock/EventBus
I would still need to add unit tests before submitting a pull request so I just wanted to see what your thoughts were first.
Rick
Issue Analytics
- State:
- Created 9 years ago
- Comments:23 (13 by maintainers)
Top GitHub Comments
This feature is implemented and can be closed.
Awesome!