From 93f239e71f4357c4cb5aeaa0940df7282cee40d3 Mon Sep 17 00:00:00 2001 From: delvh Date: Fri, 25 Sep 2020 20:58:15 +0200 Subject: [PATCH 1/2] Added paragraph about static methods in README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 07e8240..fdd33c0 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,16 @@ 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 using static methods like this + +```java + @Event + private static void onSimpleEvent(SimpleEvent event) ... +``` + +is technically possible, yet unwanted in most cases, as you have no access to an instance of the calling class. + + ## 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. -- 2.30.2 From ff163fc21ab283e6691d2ab2e760fe8b4e452be1 Mon Sep 17 00:00:00 2001 From: kske Date: Sat, 26 Sep 2020 09:57:50 +0200 Subject: [PATCH 2/2] Reword static event handler section --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fdd33c0..a4a7576 100644 --- a/README.md +++ b/README.md @@ -51,15 +51,14 @@ 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 using static methods like this +Note that creating static event handlers like this ```java @Event private static void onSimpleEvent(SimpleEvent event) ... ``` -is technically possible, yet unwanted in most cases, as you have no access to an instance of the calling class. - +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 -- 2.30.2