Skip to content

Instantly share code, notes, and snippets.

@chermehdi
Created November 4, 2018 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chermehdi/7ce4230ce0dc40643f71b3a29e82ef4f to your computer and use it in GitHub Desktop.
Save chermehdi/7ce4230ce0dc40643f71b3a29e82ef4f to your computer and use it in GitHub Desktop.
Subscribable Contract
package io.github.chermehdi.bus;
import java.util.Set;
/**
* Description of a generic subscriber
*
* @author chermehdi
*/
public interface Subscribable {
/**
* Consume the events dispatched by the bus, events passed as parameter are can only be of type
* declared by the supports() Set
*/
void handle(Event<?> event);
/**
* describes the set of classes the subscribable object intends to handle
*/
Set<Class<?>> supports();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment