Compare commits

...

3 Commits

Author SHA1 Message Date
Kai S. K. Engelbart 0e5f31b63e
Merge branch 'develop' into f/cancel-event
Conflicts:
	src/test/java/dev/kske/eventbus/EventBusTest.java
2020-11-26 08:16:01 +01:00
Leon Hofmeister cd2598d5d3 Add Section About Static Methods in README (#2)
Add paragraph about static methods in README

Co-authored-by: kske <kai@kske.dev>
Reviewed-on: https://git.kske.dev/zdm/event-bus/pulls/2
Reviewed-by: kske <kai@kske.dev>
2020-09-26 09:59:08 +02:00
Leon Hofmeister f6e5c90a44
Add static event handler test 2020-09-25 16:22:27 +02:00
1 changed files with 9 additions and 0 deletions

View File

@ -51,6 +51,15 @@ public class SimpleEventListener implements EventListener {
In this case, an event bus is created and used locally.
In a more sophisticated example the class would acquire an external event bus that is used by multiple classes.
Note that creating static event handlers like this
```java
@Event
private static void onSimpleEvent(SimpleEvent event) ...
```
is technically possible, however you would still have to create an instance of the event listener to register it at an event bus.
## Event handlers for subtypes
On certain occasions its practical for an event handler to accept both events of the specified type, as well as subclasses of that event.