Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Simplify usage of ListenerService API - MEED-7009 - Meeds-io/meeds#2116 #64

Merged
merged 1 commit into from
Jun 6, 2024

Commits on Jun 6, 2024

  1. feat: Simplify usage of ListenerService API - MEED-7009 - Meeds-io/me…

    …eds#2116
    
    **Is your feature request related to a problem? Please describe.**
    Using current implementation of `ListenerService`, it's difficult to trigger and to add event listeners. In fact the source code is very noisy when handling `ListenerService`, by example
    -  to add a Listener:
    ```java
    listenerService.addListener("event.to.catch", new EventListener<> {
      public void onEvent(Event<S, D> event) {
         // Code ....
      }
    });
    ```
    - to trigger an event:
    
    ```java
    try {
      listenerService.broadcast("", s, d);
    } catch(Exception e) {
      ....
    }
    ```
    
    This change will use `@FuntionalInterface` behavior to allow using Lambda expressions and avoid having to catch a checked exception while broadcasting event.
    boubaker committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    dea19d2 View commit details
    Browse the repository at this point in the history