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 coreEventinstances.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static DispatchEventMapperdiscardEvents()Create aDispatchEventMapperthat processes updates and records them into the rightStore, while not producing anyEventdownstream.static DispatchEventMapperemitEvents()Create aDispatchEventMapperthat 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 aDispatchContextto potentially obtain anEvent.static DispatchEventMappernoOp()Create aDispatchEventMapperthat doesn't process any dispatches
-
-
-
Method Detail
-
handle
<D,S,E extends Event> Mono<E> handle(DispatchContext<D,S> context)
Process aDispatchContextto potentially obtain anEvent.- Type Parameters:
D- the Dispatch typeE- the resulting Event type- Parameters:
context- the DispatchContext used with this Dispatch object- Returns:
- a
MonoofEventmapped from the givenDispatchContextobject, or empty if no Event is produced. If an error occurs during processing, it is emitted through theMono.
-
emitEvents
static DispatchEventMapper emitEvents()
Create aDispatchEventMapperthat processes updates and records them into the rightStore, then derives the properEvent.- Returns:
- a
DispatchEventMapperthat caches updates and producesEventinstances
-
discardEvents
static DispatchEventMapper discardEvents()
Create aDispatchEventMapperthat processes updates and records them into the rightStore, while not producing anyEventdownstream.- Returns:
- a
DispatchEventMapperthat only caches updates
-
noOp
static DispatchEventMapper noOp()
Create aDispatchEventMapperthat doesn't process any dispatches- Returns:
- a
DispatchEventMapperthat does nothing
-
-