All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.terheyden.event.ModifiableEventSubscription Maven / Gradle / Ivy

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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy