-
- Type Parameters:
E- the base event type
- All Known Implementing Classes:
SimpleEventRegistry
public interface EventRegistry<E>An event registry.- Since:
- 1.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T extends E>
@NotNull EventSubscription<T>subscribe(@NotNull Class<T> event, @NotNull EventConfig config, @NotNull EventSubscriber<? super T> subscriber)Registers the givensubscriberto receive events.default <T extends E>
@NotNull EventSubscription<T>subscribe(@NotNull Class<T> event, @NotNull EventSubscriber<? super T> subscriber)Registers the givensubscriberto receive events, using the defaultconfiguration.default booleansubscribed(@NotNull Class<? extends E> event)Determines whether the specified event has subscribers.@NotNull List<EventSubscription<? super E>>subscriptions(@NotNull Class<? extends E> event)Gets an unmodifiable list containing all subscriptions currently registered for events of typeevent.@NotNull Class<E>type()Gets the base event type.voidunsubscribeIf(@NotNull Predicate<EventSubscription<? super E>> predicate)Removes subscriptions matchingpredicate.
-
-
-
Method Detail
-
type
@NotNull @NotNull Class<E> type()
Gets the base event type.This is represented by the
Etype parameter.- Returns:
- the base event type
- Since:
- 1.0.0
-
subscribed
default boolean subscribed(@NotNull @NotNull Class<? extends E> event)Determines whether the specified event has subscribers.- Parameters:
event- the event type- Returns:
- whether the specified event has subscribers
- Since:
- 1.0.0
-
subscribe
@NotNull default <T extends E> @NotNull EventSubscription<T> subscribe(@NotNull @NotNull Class<T> event, @NotNull @NotNull EventSubscriber<? super T> subscriber)
Registers the givensubscriberto receive events, using the defaultconfiguration.- Type Parameters:
T- the event type- Parameters:
event- the event typesubscriber- the subscriber- Since:
- 1.0.0
-
subscribe
@NotNull <T extends E> @NotNull EventSubscription<T> subscribe(@NotNull @NotNull Class<T> event, @NotNull @NotNull EventConfig config, @NotNull @NotNull EventSubscriber<? super T> subscriber)
Registers the givensubscriberto receive events.- Type Parameters:
T- the event type- Parameters:
event- the event typeconfig- the event configurationsubscriber- the subscriber- Since:
- 1.0.0
-
unsubscribeIf
void unsubscribeIf(@NotNull @NotNull Predicate<EventSubscription<? super E>> predicate)Removes subscriptions matchingpredicate.- Parameters:
predicate- the predicate used to determine which subscriptions to remove- Since:
- 1.0.0
-
subscriptions
@NotNull @NotNull List<EventSubscription<? super E>> subscriptions(@NotNull @NotNull Class<? extends E> event)
Gets an unmodifiable list containing all subscriptions currently registered for events of typeevent.- Returns:
- a list of all subscriptions for events of type
event - Since:
- 1.0.0
-
-