32 lines
792 B
Java
32 lines
792 B
Java
package dev.kske.chess.event;
|
|
|
|
import java.util.Set;
|
|
|
|
/**
|
|
* Implementations of this interface can register themselves at the
|
|
* {@link EventBus} and will be triggered every time an {@link Event} of a
|
|
* supported type.<br>
|
|
* <br>
|
|
* Project: <strong>Chess</strong><br>
|
|
* File: <strong>Subscribable.java</strong><br>
|
|
* Created: <strong>7 Aug 2019</strong><br>
|
|
*
|
|
* @since Chess v0.4-alpha
|
|
* @author Kai S. K. Engelbart
|
|
*/
|
|
public interface Subscriber {
|
|
|
|
/**
|
|
* Consumes an event dispatched by an event bus.
|
|
*
|
|
* @param event The event dispatched by the event bus, only of supported
|
|
* type
|
|
*/
|
|
void handle(Event<?> event);
|
|
|
|
/**
|
|
* @return A set of classes this class is supposed to handle in events
|
|
*/
|
|
Set<Class<?>> supports();
|
|
}
|