Package io.fluxcapacitor.common.handling
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 ParameterResolver
s 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 TypeMethodDescriptionboolean
Returns whether the given message can be handled by a handler instance of typeT
.protected Class
<?> getInvoker
(Object target, M m) Attempts to resolve aHandlerInvoker
for the given target instance and message.protected int
getPriority
(Annotation annotation) protected boolean
isPassive
(Annotation annotation) matchingMethods
(M message) Returns a stream of methods from the target class that match the given message.protected int
methodIndex
(Method instanceMethod, Class<?> instanceType) protected Optional
<Function<Object, HandlerInvoker>> prepareInvoker
(M m) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.common.handling.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:HandlerMatcher
Returns 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:
canHandle
in interfaceHandlerMatcher<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
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 interfaceHandlerMatcher<Object,
M> - Parameters:
message
- the message to match against- Returns:
- a stream of matching
Executable
handler methods
-
prepareInvoker
-
getInvoker
Description copied from interface:HandlerMatcher
Attempts to resolve aHandlerInvoker
for the given target instance and message.- Specified by:
getInvoker
in 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
-