Class HandlerInspector.MethodHandlerMatcher<M>

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

public static class HandlerInspector.MethodHandlerMatcher<M> extends Object implements HandlerMatcher<Object,M>
A matcher that encapsulates metadata and resolution logic for a single handler method or constructor.

Resolves parameter values using ParameterResolvers and builds a HandlerInvoker for invoking the method on a given target instance.

This matcher supports prioritization, specificity analysis, and filtering based on annotations and parameters.

  • Field Details

  • Constructor Details

  • 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
    • prepareInvoker

      protected Optional<Function<Object,HandlerInvoker>> prepareInvoker(M m)
    • getInvoker

      public Optional<HandlerInvoker> getInvoker(Object target, M m)
      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
      m - the message to be handled
      Returns:
      an optional invoker if the message is supported by the target; empty otherwise
    • computeClassForSpecificity

      protected Class<?> computeClassForSpecificity()
    • methodIndex

      protected int methodIndex(Method instanceMethod, Class<?> instanceType)
    • getPriority

      protected int getPriority(Annotation annotation)
    • isPassive

      protected boolean isPassive(Annotation annotation)