Package org.linkki.util.handler
Interface Handler
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Handler
A functional interface to proceed any operation. May be used to provide click handler or any other runnable action.Handlers can be composed using the
andThen(Handler)method.
-
-
Field Summary
Fields Modifier and Type Field Description static HandlerNOP_HANDLERA handler that does nothing.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default HandlerandThen(Handler after)voidapply()Called when the handler should be applied.default Handlercompose(Handler before)Returns a composed handler that first applies thebeforehandler, and then applies this handler.
-
-
-
Field Detail
-
NOP_HANDLER
static final Handler NOP_HANDLER
A handler that does nothing.
-
-
Method Detail
-
apply
void apply()
Called when the handler should be applied.
-
andThen
default Handler andThen(Handler after)
Returns a composed handler that first executes this handler'sapply()method and then theapply()method of the given handler.- See Also:
compose(Handler)
-
compose
default Handler compose(Handler before)
Returns a composed handler that first applies thebeforehandler, and then applies this handler. If evaluation of either handler throws an exception, it is relayed to the caller of the composed handler.- Parameters:
before- the handler to apply before this handler is applied- Returns:
- a composed handler that first applies the
beforehandler and then applies this handler - Throws:
NullPointerException- if before is null- See Also:
andThen(Handler)
-
-