C
- the type of class of the dispatched messagesE
- the type of the message envelopespublic interface MessageDispatcher<C extends io.spine.type.MessageClass,E extends MessageEnvelope>
Modifier and Type | Method and Description |
---|---|
default boolean |
canDispatch(E envelope)
Checks if this dispatcher can dispatch the given message.
|
void |
dispatch(E envelope)
Dispatches the message contained in the passed envelope.
|
com.google.common.collect.ImmutableSet<C> |
messageClasses()
Obtains a set of message classes that can be processed by this dispatcher.
|
com.google.common.collect.ImmutableSet<C> messageClasses()
void dispatch(E envelope)
envelope
- the envelope with the messagedefault boolean canDispatch(E envelope)
This method does not check that the type of the message is one of the dispatched message classes. Instead, it validates the message upon some custom rules of this dispatcher.
Extend this method to forbid messages from being dispatched to this instance.
envelope
- the message to checktrue
is the given message can be dispatched by this dispatcher,
false
otherwise