com.terheyden.event.EventQuerySubscription Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of event-router Show documentation
Show all versions of event-router Show documentation
Simple, fast, flexible event router / event bus for Java
The newest version!
package com.terheyden.event;
import java.util.UUID;
/**
* An {@link EventQueryImpl} subscription.
* Has a UUID to identify it, and the handler to apply to incoming event objects.
*/
final class EventQuerySubscription implements EventSubscription {
private final UUID subscriptionId;
private final CheckedFunction eventHandler;
EventQuerySubscription(
UUID subscriptionId,
CheckedFunction eventHandler) {
this.subscriptionId = subscriptionId;
this.eventHandler = eventHandler;
}
EventQuerySubscription(CheckedFunction eventHandler) {
this(UUID.randomUUID(), eventHandler);
}
@Override
public UUID getSubscriptionId() {
return subscriptionId;
}
public CheckedFunction getEventHandler() {
return eventHandler;
}
}