Class HandlerInspector.MethodHandlerMatcher<M>
java.lang.Object
io.fluxzero.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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Comparator<HandlerInspector.MethodHandlerMatcher<?>> -
Constructor Summary
ConstructorsConstructorDescriptionMethodHandlerMatcher(Executable executable, Class<?> targetClass, List<ParameterResolver<? super M>> parameterResolvers, @NonNull HandlerConfiguration<? super M> config) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether the given message can be handled by a handler instance of typeT.protected Class<?> getInvoker(Object target, M m) Attempts to resolve aHandlerInvokerfor the given target instance and message.protected intgetPriority(Annotation annotation) protected booleanisPassive(Annotation annotation) matchingMethods(M message) Returns a stream of methods from the target class that match the given message.protected intmethodIndex(Method instanceMethod, Class<?> instanceType) protected Optional<Function<Object, HandlerInvoker>> prepareInvoker(M m) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HandlerMatcher
or
-
Field Details
-
comparator
-
-
Constructor Details
-
MethodHandlerMatcher
public MethodHandlerMatcher(Executable executable, Class<?> targetClass, List<ParameterResolver<? super M>> parameterResolvers, @NonNull @NonNull HandlerConfiguration<? super M> config)
-
-
Method Details
-
canHandle
Description copied from interface:HandlerMatcherReturns whether the given message can be handled by a handler instance of typeT. This is a lightweight check and may be used for fast filtering or diagnostics.- Specified by:
canHandlein interfaceHandlerMatcher<Object,M> - Parameters:
message- the message to check- Returns:
trueif the matcher may be able to produce an invoker for the given message
-
matchingMethods
Description copied from interface:HandlerMatcherReturns a stream of methods from the target class that match the given message. Typically used for diagnostics or documentation tools.- Specified by:
matchingMethodsin interfaceHandlerMatcher<Object,M> - Parameters:
message- the message to match against- Returns:
- a stream of matching
Executablehandler methods
-
prepareInvoker
-
getInvoker
Description copied from interface:HandlerMatcherAttempts to resolve aHandlerInvokerfor the given target instance and message.- Specified by:
getInvokerin interfaceHandlerMatcher<Object,M> - Parameters:
target- the handler objectm- the message to be handled- Returns:
- an optional invoker if the message is supported by the target; empty otherwise
-
computeClassForSpecificity
-
methodIndex
-
getPriority
-
isPassive
-