Document Latest Features in README #27
@ -204,7 +204,7 @@ In more complex setups, taking a look at the event handler execution order can b
|
||||
Event Bus offers a method for this purpose which can be used as follows:
|
||||
|
||||
```java
|
||||
System.out.println(EventBus.getInstance().printExecutionOrder(SimpleEvent.class));
|
||||
System.out.println(EventBus.getInstance().debugExecutionOrder(SimpleEvent.class));
|
||||
kske marked this conversation as resolved
Outdated
|
||||
```
|
||||
|
||||
Then, the execution order can be inspected in the console.
|
||||
|
@ -381,7 +381,7 @@ public final class EventBus {
|
||||
* @return a human-readable event handler list suitable for debugging purposes
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public String printExecutionOrder(Class<?> eventType) {
|
||||
public String debugExecutionOrder(Class<?> eventType) {
|
||||
var handlers = getHandlersFor(eventType);
|
||||
var sj = new StringJoiner("\n");
|
||||
|
||||
|
@ -45,13 +45,13 @@ class DispatchTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link EventBus#printExecutionOrder(Class)} based on the currently registered handlers.
|
||||
* Tests {@link EventBus#debugExecutionOrder(Class)} based on the currently registered handlers.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@Test
|
||||
void testPrintExecutionOrder() {
|
||||
String executionOrder = bus.printExecutionOrder(SimpleEvent.class);
|
||||
String executionOrder = bus.debugExecutionOrder(SimpleEvent.class);
|
||||
System.out.println(executionOrder);
|
||||
assertEquals(
|
||||
"Event handler execution order for class dev.kske.eventbus.core.SimpleEvent (3 handler(s)):\n"
|
||||
|
Loading…
Reference in New Issue
Block a user
Something looks strange here:
a) if
printXY
prints directly, thesyso
part is unneeded.b) if
printXY
only returns the result, then the function should be renamed.The code itself is correct, but I agree that the name of the method can be misleading. What would you call a method that formats the execution order in a human-readable way as a string, but doesn't print it. Printing it to sysout directly seemed to specific to me, as some applications would prefer using a logger instead.
generateExecutionOrder
?getDebugInformation
?createExecutionOrderString
?executionOrderAsString
?getExecutionOrderAsString
?