Interface HandlerInputResolver<M>
- Type Parameters:
M- the message type used by the handling pipeline
- All Superinterfaces:
ParameterResolver<M>
- All Known Implementing Classes:
MessageParameterResolver, MetadataParameterResolver, PayloadParameterResolver, UserParameterResolver
ParameterResolver for resolving handler parameters from a HandlerInput.
Implementing this interface allows Fluxzero to select a handler method once and reuse its argument-resolution functions for later inputs. This is primarily useful for parameter resolvers on frequently invoked local handlers. Regular parameter resolvers do not need to implement it; Fluxzero will use the normal message-based handling path when a method cannot be prepared safely.
The cache key is part of the correctness contract. Two inputs with equal keys must always produce the same match
decision, and every function returned by prepareInput(Parameter, Annotation, HandlerInput) must remain
valid for both inputs.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordDescribes what a resolver decided for one handler parameter. -
Method Summary
Modifier and TypeMethodDescriptiongetInputCacheKey(Parameter parameter, Annotation methodAnnotation, HandlerInput<M> representative) Returns a key containing every input property that can affect whether this resolver matches the parameter and how the parameter value is resolved.default booleanisNoMatchPayloadClassKey(Parameter parameter, Annotation methodAnnotation, HandlerInput<M> representative) Returns whether an unmatched result is guaranteed to remain unmatched for every payload with the same runtime class.default booleanisPayloadClassKey(Parameter parameter, Annotation methodAnnotation, HandlerInput<M> representative) Returns whether the payload's runtime class alone determines this resolver's successful result for the supplied parameter.prepareInput(Parameter parameter, Annotation methodAnnotation, HandlerInput<M> representative) Determines whether this resolver handles the parameter and, when it does, creates the function that supplies the parameter value during invocation.Methods inherited from interface ParameterResolver
determinesSpecificity, matches, mayApply, prepare, resolve, specificityPriority, test
-
Method Details
-
getInputCacheKey
Object getInputCacheKey(Parameter parameter, Annotation methodAnnotation, HandlerInput<M> representative) Returns a key containing every input property that can affect whether this resolver matches the parameter and how the parameter value is resolved.Return
nullwhen no safe reusable key can be provided. Fluxzero will then fall back to normal per-message resolution. Keys are compared usingObject.equals(Object)and must be stable after they are returned.- Parameters:
parameter- the handler parameter to resolvemethodAnnotation- the annotation that marks the handler method, if presentrepresentative- an input representative of the group to be cached- Returns:
- a stable, complete cache key, or
nullto disable prepared resolution for this input
-
isPayloadClassKey
default boolean isPayloadClassKey(Parameter parameter, Annotation methodAnnotation, HandlerInput<M> representative) Returns whether the payload's runtime class alone determines this resolver's successful result for the supplied parameter.Return
trueonly if every payload of that class produces the same match decision and may use the same prepared resolver. This enables a faster class-based lookup.- Returns:
trueif the result can safely be reused for every payload of the same runtime class
-
isNoMatchPayloadClassKey
default boolean isNoMatchPayloadClassKey(Parameter parameter, Annotation methodAnnotation, HandlerInput<M> representative) Returns whether an unmatched result is guaranteed to remain unmatched for every payload with the same runtime class.This is separate from
isPayloadClassKey(Parameter, Annotation, HandlerInput)because matching and non-matching inputs may require different cache guarantees.- Returns:
trueif the non-match can safely be reused for the entire payload class
-
prepareInput
HandlerInputResolver.Resolution<M> prepareInput(Parameter parameter, Annotation methodAnnotation, HandlerInput<M> representative) Determines whether this resolver handles the parameter and, when it does, creates the function that supplies the parameter value during invocation.The result must agree with normal
ParameterResolverselection, including any contribution the resolver makes to handler specificity.- Parameters:
parameter- the handler parameter to resolvemethodAnnotation- the annotation that marks the handler method, if presentrepresentative- an input representative of the cache key returned for this parameter- Returns:
- an unmatched, rejected, or successfully resolved result
-