com.terheyden.event.ModifiableEventSubscription 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;
/**
* A {@link ModifiableEventRouterImpl} subscription.
* Has a UUID to identify it, and the handler to apply to incoming event objects.
*/
final class ModifiableEventSubscription implements EventSubscription {
private final UUID subscriptionId;
private final CheckedFunction eventHandler;
ModifiableEventSubscription(
UUID subscriptionId,
CheckedFunction eventHandler) {
this.subscriptionId = subscriptionId;
this.eventHandler = eventHandler;
}
ModifiableEventSubscription(CheckedFunction eventHandler) {
this(UUID.randomUUID(), eventHandler);
}
@Override
public UUID getSubscriptionId() {
return subscriptionId;
}
public CheckedFunction getEventHandler() {
return eventHandler;
}
}