Package org.drasyl.pipeline
Class HandlerAdapter
java.lang.Object
org.drasyl.pipeline.HandlerAdapter
- All Implemented Interfaces:
Handler
- Direct Known Subclasses:
AddressHandlerAdapter
Skeleton implementation of a
Handler
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
eventTriggered
(HandlerContext ctx, Event event, CompletableFuture<Void> future) Gets called if aEvent
was emitted.void
exceptionCaught
(HandlerContext ctx, Exception cause) Gets called if aException
was thrown.void
Do nothing by default, sub-classes may override this method.void
Do nothing by default, sub-classes may override this method.void
read
(HandlerContext ctx, Address sender, Object msg, CompletableFuture<Void> future) Gets called if aObject
was received.void
write
(HandlerContext ctx, Address recipient, Object msg, CompletableFuture<Void> future) Gets called if aObject
was send from the application to a recipient.
-
Constructor Details
-
HandlerAdapter
public HandlerAdapter()
-
-
Method Details
-
handlerAdded
Do nothing by default, sub-classes may override this method.- Specified by:
handlerAdded
in interfaceHandler
-
handlerRemoved
Do nothing by default, sub-classes may override this method.- Specified by:
handlerRemoved
in interfaceHandler
-
read
Description copied from interface:Handler
Gets called if aObject
was received. -
eventTriggered
Description copied from interface:Handler
Gets called if aEvent
was emitted.- Specified by:
eventTriggered
in interfaceHandler
- Parameters:
ctx
- handler contextevent
- the eventfuture
- a future for the message
-
exceptionCaught
Description copied from interface:Handler
Gets called if aException
was thrown.- Specified by:
exceptionCaught
in interfaceHandler
-
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.
-