Class Handler.DelegatingHandler<M>

java.lang.Object
io.fluxzero.common.handling.Handler.DelegatingHandler<M>
Type Parameters:
M - the message type
All Implemented Interfaces:
Handler<M>
Enclosing interface:
Handler<M>

public abstract static class Handler.DelegatingHandler<M> extends Object implements Handler<M>
Abstract base class for Handler implementations that delegate to another handler.

This is useful for decorating or extending handler behavior while preserving its target class and delegation logic.

  • Field Details

    • delegate

      protected final Handler<M> delegate
  • Constructor Details

    • DelegatingHandler

      public DelegatingHandler()
  • Method Details

    • getTargetClass

      public Class<?> getTargetClass()
      Description copied from interface: Handler
      Returns the class of the handler's target object. This may be used for reflective operations, logging, or framework-level behavior.
      Specified by:
      getTargetClass in interface Handler<M>
      Returns:
      the class of the handler's target
    • getHandlerMethodOrNull

      public HandlerMethod<M> getHandlerMethodOrNull(M message)
      Description copied from interface: Handler
      Returns a reusable HandlerMethod capable of processing the given message, or null when unavailable.

      This is an optional lower-allocation path for handlers whose target and method plan can be reused across messages. Implementations that cannot expose a stable method should return null and rely on Handler.getInvokerOrNull(Object).

      Specified by:
      getHandlerMethodOrNull in interface Handler<M>
      Parameters:
      message - the message to be handled
      Returns:
      a handler method if this handler can handle the message through a reusable method; null otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object