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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy