Interface ChannelManager
-
public interface ChannelManager
A manager handling custom payloads viaChannel
s to and fromEngineConnection
s.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Collection<Channel>
channels()
Gets an immutable collection of all the channels that are registered.java.util.Optional<Channel>
get(ResourceKey channelKey)
Gets a channel binding if a channel exists for the given key.<C extends Channel>
CofType(ResourceKey channelKey, java.lang.Class<C> channelType)
Gets aChannel
by the given channel key.
-
-
-
Method Detail
-
get
java.util.Optional<Channel> get(ResourceKey channelKey)
Gets a channel binding if a channel exists for the given key.- Parameters:
channelKey
- The channel key- Returns:
- The channel if it exists
-
ofType
<C extends Channel> C ofType(ResourceKey channelKey, java.lang.Class<C> channelType)
Gets aChannel
by the given channel key. If the channel exists and it matches the given channel type, it is returned. If the channel doesn't match aIllegalStateException
is thrown.- Parameters:
channelKey
- The channel keychannelType
- The channel type- Returns:
- A new or existing channel binding
- Throws:
java.lang.IllegalStateException
- if the existing channel is not of the given type
-
channels
java.util.Collection<Channel> channels()
Gets an immutable collection of all the channels that are registered.- Returns:
- The channels
-
-