Class HandlerInspector.ObjectHandlerMatcher<M>

java.lang.Object
io.fluxcapacitor.common.handling.HandlerInspector.ObjectHandlerMatcher<M>
All Implemented Interfaces:
HandlerMatcher<Object,M>
Enclosing class:
HandlerInspector

public static class HandlerInspector.ObjectHandlerMatcher<M> extends Object implements HandlerMatcher<Object,M>
A composite HandlerMatcher that delegates to a list of individual matchers.

Supports invoking one or multiple methods depending on configuration.

  • Constructor Details

    • ObjectHandlerMatcher

      public ObjectHandlerMatcher()
  • Method Details

    • canHandle

      public boolean canHandle(M message)
      Description copied from interface: HandlerMatcher
      Returns whether the given message can be handled by a handler instance of type T. This is a lightweight check and may be used for fast filtering or diagnostics.
      Specified by:
      canHandle in interface HandlerMatcher<Object,M>
      Parameters:
      message - the message to check
      Returns:
      true if the matcher may be able to produce an invoker for the given message
    • matchingMethods

      public Stream<Executable> matchingMethods(M message)
      Description copied from interface: HandlerMatcher
      Returns a stream of methods from the target class that match the given message. Typically used for diagnostics or documentation tools.
      Specified by:
      matchingMethods in interface HandlerMatcher<Object,M>
      Parameters:
      message - the message to match against
      Returns:
      a stream of matching Executable handler methods
    • getInvoker

      public Optional<HandlerInvoker> getInvoker(Object target, M message)
      Description copied from interface: HandlerMatcher
      Attempts to resolve a HandlerInvoker for the given target instance and message.
      Specified by:
      getInvoker in interface HandlerMatcher<Object,M>
      Parameters:
      target - the handler object
      message - the message to be handled
      Returns:
      an optional invoker if the message is supported by the target; empty otherwise