Package discord4j.core.event.dispatch
Interface DispatchEventMapper
-
- All Known Implementing Classes:
DispatchHandlers
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface @Experimental public interface DispatchEventMapper
A transformation between Gateway inbound Dispatch class of payloads to Discord4J coreEvent
instances.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static DispatchEventMapper
discardEvents()
Create aDispatchEventMapper
that processes updates and records them into the rightStore
, while not producing anyEvent
downstream.static DispatchEventMapper
emitEvents()
Create aDispatchEventMapper
that processes updates and records them into the rightStore
, then derives the properEvent
.<D,S,E extends Event>
Mono<E>handle(DispatchContext<D,S> context)
Process aDispatchContext
to potentially obtain anEvent
.static DispatchEventMapper
noOp()
Create aDispatchEventMapper
that doesn't process any dispatches
-
-
-
Method Detail
-
handle
<D,S,E extends Event> Mono<E> handle(DispatchContext<D,S> context)
Process aDispatchContext
to potentially obtain anEvent
.- Type Parameters:
D
- the Dispatch typeE
- the resulting Event type- Parameters:
context
- the DispatchContext used with this Dispatch object- Returns:
- a
Mono
ofEvent
mapped from the givenDispatchContext
object, or empty if no Event is produced. If an error occurs during processing, it is emitted through theMono
.
-
emitEvents
static DispatchEventMapper emitEvents()
Create aDispatchEventMapper
that processes updates and records them into the rightStore
, then derives the properEvent
.- Returns:
- a
DispatchEventMapper
that caches updates and producesEvent
instances
-
discardEvents
static DispatchEventMapper discardEvents()
Create aDispatchEventMapper
that processes updates and records them into the rightStore
, while not producing anyEvent
downstream.- Returns:
- a
DispatchEventMapper
that only caches updates
-
noOp
static DispatchEventMapper noOp()
Create aDispatchEventMapper
that doesn't process any dispatches- Returns:
- a
DispatchEventMapper
that does nothing
-
-