Add Section About Static Methods in README #2
@ -51,15 +51,14 @@ public class SimpleEventListener implements EventListener {
|
|||||||
In this case, an event bus is created and used locally.
|
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.
|
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
|
```java
|
||||||
@Event
|
@Event
|
||||||
private static void onSimpleEvent(SimpleEvent 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
|
## Event handlers for subtypes
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user