com.remondis.limbus.events.EventMulticasterFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of limbus-event-multicaster Show documentation
Show all versions of limbus-event-multicaster Show documentation
Module for a datastructure that allows to multicast method invocations to subscribers.
package com.remondis.limbus.events;
import com.remondis.limbus.utils.Lang;
import com.remondis.limbus.utils.ReflectionUtil;
/**
* Factory to create {@link EventMulticaster} instances.
*
* @author schuettec
*
*/
public class EventMulticasterFactory {
/**
* Creates an {@link EventMulticaster} for the specified subscriber type. The {@link EventMulticaster} created will
* forward thrown exceptions from subscribers. Note: An exception aborts the notifaction of further
* subscribers.
*
* @param subscriberType
* The subscriber interface.
*
* @return Returns the {@link EventMulticaster}.
*/
public static EventMulticaster create(Class subscriberType) {
Lang.denyNull("subscriber type", subscriberType);
ReflectionUtil.denyNotInterface(subscriberType);
MulticastHandler handler = new MulticastHandler(subscriberType);
return handler;
}
}