public final class EventWhiteList extends java.lang.Object implements EventFilter
EventFilter
which allows only events of given types.
All other events are discarded by this filter by default.
Caution: Make sure you are aware of consequences of discarding system events posted by a repository when using this filter.
EventBlackList
Modifier and Type | Method and Description |
---|---|
static EventWhiteList |
allowEvents(java.lang.Class<? extends io.spine.base.EventMessage>... eventClasses)
Creates a new instance of
EventWhiteList allowing events of the given types. |
java.util.Optional<? extends io.spine.base.EventMessage> |
filter(io.spine.base.EventMessage event)
Applies this filter to the given event.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
allowAll, filter
@SafeVarargs public static EventWhiteList allowEvents(java.lang.Class<? extends io.spine.base.EventMessage>... eventClasses)
EventWhiteList
allowing events of the given types.eventClasses
- the allowed event classespublic java.util.Optional<? extends io.spine.base.EventMessage> filter(io.spine.base.EventMessage event)
EventFilter
filter
in interface EventFilter
event
- the event to apply the filter toOptional.empty()
if the event should not be posted