Package org.drasyl.pipeline.skeleton
Class SimpleDuplexEventAwareHandler<I,E,O,A extends Address>
- 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,E,O,A>
-
- All Implemented Interfaces:
Handler
- Direct Known Subclasses:
SimpleDuplexHandler
public abstract class SimpleDuplexEventAwareHandler<I,E,O,A extends Address> extends SimpleInboundEventAwareHandler<I,E,A>
HandlerAdapter
which allows to explicit only handle a specific type of messages and events.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleDuplexEventAwareHandler()
protected
SimpleDuplexEventAwareHandler(Class<? extends I> inboundMessageType, Class<? extends E> inboundEventType, Class<? extends O> outboundMessageType, Class<? extends A> addressType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
acceptOutbound(Object msg)
Returnstrue
if the given message should be handled.protected abstract void
matchedWrite(HandlerContext ctx, A recipient, O msg, CompletableFuture<Void> future)
Is called for each message of typeSimpleDuplexEventAwareHandler
.void
write(HandlerContext ctx, Address recipient, Object msg, CompletableFuture<Void> future)
Gets called if aObject
was send from the application to a recipient.-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleInboundEventAwareHandler
acceptEvent, acceptInbound, eventTriggered, matchedEventTriggered, matchedRead, read
-
Methods inherited from class org.drasyl.pipeline.skeleton.AddressHandlerAdapter
acceptAddress
-
Methods inherited from class org.drasyl.pipeline.skeleton.HandlerAdapter
exceptionCaught, handlerAdded, handlerRemoved
-
-
-
-
Method Detail
-
write
public void write(HandlerContext ctx, Address recipient, Object msg, CompletableFuture<Void> future)
Description copied from interface:Handler
Gets called if aObject
was send from the application to a recipient.- Specified by:
write
in interfaceHandler
- Overrides:
write
in classHandlerAdapter
- Parameters:
ctx
- handler contextrecipient
- the recipient of the messagemsg
- the messagefuture
- a future for the message
-
acceptOutbound
protected boolean acceptOutbound(Object msg)
-
matchedWrite
protected abstract void matchedWrite(HandlerContext ctx, A recipient, O msg, CompletableFuture<Void> future)
Is called for each message of typeSimpleDuplexEventAwareHandler
.- Parameters:
ctx
- handler contextrecipient
- the recipient of the messagemsg
- the messagefuture
- a future for the message
-
-