Package org.glassfish.tyrus.core
Class MessageHandlerManager
java.lang.Object
org.glassfish.tyrus.core.MessageHandlerManager
Manages registered
MessageHandler
s and checks whether the new ones may be registered.- Author:
- Stepan Kopriva, Pavel Bucek
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMessageHandler
(MessageHandler handler) AddMessageHandler
to the manager.<T> void
addMessageHandler
(Class<T> clazz, MessageHandler.Partial<T> handler) AddMessageHandler.Partial
to the manager.<T> void
addMessageHandler
(Class<T> clazz, MessageHandler.Whole<T> handler) AddMessageHandler.Whole
to the manager.static MessageHandlerManager
fromDecoderClasses
(List<Class<? extends Decoder>> decoderClasses) Construct manager.Get all successfully registeredMessageHandler
s.List
<Map.Entry<Class<?>, MessageHandler>> boolean
boolean
void
removeMessageHandler
(MessageHandler handler) RemoveMessageHandler
from the manager.
-
Constructor Details
-
MessageHandlerManager
public MessageHandlerManager()Construct manager with no decoders.
-
-
Method Details
-
fromDecoderClasses
public static MessageHandlerManager fromDecoderClasses(List<Class<? extends Decoder>> decoderClasses) Construct manager.- Parameters:
decoderClasses
- registeredDecoder
s.- Returns:
- constructed message handler manager.
-
addMessageHandler
AddMessageHandler
to the manager.- Parameters:
handler
-MessageHandler
to be added to the manager.- Throws:
IllegalStateException
-
addMessageHandler
public <T> void addMessageHandler(Class<T> clazz, MessageHandler.Whole<T> handler) throws IllegalStateException AddMessageHandler.Whole
to the manager.- Type Parameters:
T
- type of message to be handled.- Parameters:
clazz
- type handled byMessageHandler
.handler
-MessageHandler
to be added.- Throws:
IllegalStateException
- when the message handler cannot be added.
-
addMessageHandler
public <T> void addMessageHandler(Class<T> clazz, MessageHandler.Partial<T> handler) throws IllegalStateException AddMessageHandler.Partial
to the manager.- Type Parameters:
T
- type of message to be handled.- Parameters:
clazz
- type handled byMessageHandler
.handler
-MessageHandler
to be added.- Throws:
IllegalStateException
- when the message handler cannot be added.
-
removeMessageHandler
RemoveMessageHandler
from the manager.- Parameters:
handler
- handler which will be removed.
-
getMessageHandlers
Get all successfully registeredMessageHandler
s.- Returns:
- unmodifiable
Set
of registeredMessageHandler
s.
-
getOrderedWholeMessageHandlers
-
isReaderHandlerPresent
public boolean isReaderHandlerPresent() -
isInputStreamHandlerPresent
public boolean isInputStreamHandlerPresent()
-