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.
A transformation between Gateway inbound Dispatch class of payloads to Discord4J core
Event
instances.-
Method Summary
Modifier and TypeMethodDescriptionstatic DispatchEventMapper
Create aDispatchEventMapper
that processes updates and records them into the rightStore
, while not producing anyEvent
downstream.static DispatchEventMapper
Create aDispatchEventMapper
that processes updates and records them into the rightStore
, then derives the properEvent
.handle
(DispatchContext<D, S> context) Process aDispatchContext
to potentially obtain anEvent
.static DispatchEventMapper
noOp()
Create aDispatchEventMapper
that doesn't process any dispatches
-
Method Details
-
handle
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
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
Create aDispatchEventMapper
that processes updates and records them into the rightStore
, while not producing anyEvent
downstream.- Returns:
- a
DispatchEventMapper
that only caches updates
-
noOp
Create aDispatchEventMapper
that doesn't process any dispatches- Returns:
- a
DispatchEventMapper
that does nothing
-