Class MessageSerializer
- java.lang.Object
-
- org.drasyl.pipeline.skeleton.HandlerAdapter
-
- org.drasyl.pipeline.skeleton.AddressHandlerAdapter<A>
-
- org.drasyl.pipeline.skeleton.SimpleInboundEventAwareHandler<I,E,A>
-
- org.drasyl.pipeline.skeleton.SimpleDuplexEventAwareHandler<I,Event,O,A>
-
- org.drasyl.pipeline.skeleton.SimpleDuplexHandler<SerializedApplicationMessage,ApplicationMessage,Address>
-
- org.drasyl.pipeline.serialization.MessageSerializer
-
- All Implemented Interfaces:
Handler
public final class MessageSerializer extends SimpleDuplexHandler<SerializedApplicationMessage,ApplicationMessage,Address>
This handler serializes messages to byte array an vice vera.
-
-
Field Summary
Fields Modifier and Type Field Description static MessageSerializer
INSTANCE
static String
MESSAGE_SERIALIZER
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
matchedRead(HandlerContext ctx, Address sender, SerializedApplicationMessage msg, CompletableFuture<Void> future)
Is called for each message of typeSimpleInboundEventAwareHandler
.protected void
matchedWrite(HandlerContext ctx, Address recipient, ApplicationMessage msg, CompletableFuture<Void> future)
Is called for each message of typeSimpleDuplexEventAwareHandler
.-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleDuplexHandler
eventTriggered, matchedEventTriggered
-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleDuplexEventAwareHandler
acceptOutbound, write
-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleInboundEventAwareHandler
acceptEvent, acceptInbound, read
-
Methods inherited from class org.drasyl.pipeline.skeleton.AddressHandlerAdapter
acceptAddress
-
Methods inherited from class org.drasyl.pipeline.skeleton.HandlerAdapter
exceptionCaught, handlerAdded, handlerRemoved
-
-
-
-
Field Detail
-
INSTANCE
public static final MessageSerializer INSTANCE
-
MESSAGE_SERIALIZER
public static final String MESSAGE_SERIALIZER
- See Also:
- Constant Field Values
-
-
Method Detail
-
matchedRead
protected void matchedRead(HandlerContext ctx, Address sender, SerializedApplicationMessage msg, CompletableFuture<Void> future)
Description copied from class:SimpleInboundEventAwareHandler
Is called for each message of typeSimpleInboundEventAwareHandler
.- Specified by:
matchedRead
in classSimpleInboundEventAwareHandler<SerializedApplicationMessage,Event,Address>
- Parameters:
ctx
- handler contextsender
- the sender of the messagemsg
- the messagefuture
- the future of the message
-
matchedWrite
protected void matchedWrite(HandlerContext ctx, Address recipient, ApplicationMessage msg, CompletableFuture<Void> future)
Description copied from class:SimpleDuplexEventAwareHandler
Is called for each message of typeSimpleDuplexEventAwareHandler
.- Specified by:
matchedWrite
in classSimpleDuplexEventAwareHandler<SerializedApplicationMessage,Event,ApplicationMessage,Address>
- Parameters:
ctx
- handler contextrecipient
- the recipient of the messagemsg
- the messagefuture
- a future for the message
-
-