Class EventChunkHandlerFactory
java.lang.Object
eu.cloudnetservice.driver.network.chunk.event.EventChunkHandlerFactory
- All Implemented Interfaces:
Function<ChunkSessionInformation, ChunkedPacketHandler>
public final class EventChunkHandlerFactory
extends Object
implements Function<ChunkSessionInformation, ChunkedPacketHandler>
Represents a factory for chunked packet handlers using the
ChunkedPacketSessionOpenEvent to determine which
handler to use for a chunked session.- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEventChunkHandlerFactory(@NonNull EventManager eventManager) Constructs a new event chunk handler factory instance. -
Method Summary
Modifier and TypeMethodDescriptionGet a new handler for the given session information based on the event call result (and therefore the result a listener of theChunkedPacketSessionOpenEventset).
-
Field Details
-
eventManager
-
-
Constructor Details
-
EventChunkHandlerFactory
Constructs a new event chunk handler factory instance.- Parameters:
eventManager- the event manager to use to call events.- Throws:
NullPointerException- if the given event manager is null.
-
-
Method Details
-
apply
Get a new handler for the given session information based on the event call result (and therefore the result a listener of theChunkedPacketSessionOpenEventset).- Specified by:
applyin interfaceFunction<ChunkSessionInformation, ChunkedPacketHandler>- Parameters:
info- the session info to get the handler for.- Returns:
- the packet handler for the session set by the last listener in the chain.
- Throws:
IllegalStateException- if no listener in the chain set a handler.NullPointerException- if the given session info is null.
-