Package org.drasyl.pipeline.skeleton
Class HandlerAdapter
- java.lang.Object
-
- org.drasyl.pipeline.skeleton.HandlerAdapter
-
- All Implemented Interfaces:
Handler
- Direct Known Subclasses:
AddressHandlerAdapter
public class HandlerAdapter extends Object implements Handler
Skeleton implementation of aHandler
.
-
-
Constructor Summary
Constructors Constructor Description HandlerAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
handlerAdded(HandlerContext ctx)
Do nothing by default, sub-classes may override this method.void
handlerRemoved(HandlerContext ctx)
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.
-
-
-
Method Detail
-
handlerAdded
public void handlerAdded(HandlerContext ctx)
Do nothing by default, sub-classes may override this method.- Specified by:
handlerAdded
in interfaceHandler
-
handlerRemoved
public void handlerRemoved(HandlerContext ctx)
Do nothing by default, sub-classes may override this method.- Specified by:
handlerRemoved
in interfaceHandler
-
read
@Skip public void read(HandlerContext ctx, Address sender, Object msg, CompletableFuture<Void> future)
Description copied from interface:Handler
Gets called if aObject
was received.
-
eventTriggered
@Skip public void eventTriggered(HandlerContext ctx, Event event, CompletableFuture<Void> future)
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
@Skip public void exceptionCaught(HandlerContext ctx, Exception cause)
Description copied from interface:Handler
Gets called if aException
was thrown.- Specified by:
exceptionCaught
in interfaceHandler
-
write
@Skip 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.
-
-