/basicevents

Basic event handler implementation for java

Primary LanguageJava

BasicEvents

Simple event handler written in Java 8

Usage

Creating the Handler

EventHandler handler = new EventHandler();
[...]
handler.register(new Listener());
[...]
handler.handle(new TestEvent(42));

Listener

class Listener implements EventListener {
    @Event
    public void onTest(TestEvent event) {
        System.out.println("Event has been called!");
        TEST_RESULT = event.value;
    }
}

Event class

class TestEvent implements BasicEvent {
    private int value;

    public TestEvent(int value) {
        this.value = value;
    }
}

Example

See SimpleTest

Import

For maven/gradle releases see Jitpack