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

public interface HandlerInputResolver<M> extends ParameterResolver<M>
Optional extension of 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.

  • 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 null when no safe reusable key can be provided. Fluxzero will then fall back to normal per-message resolution. Keys are compared using Object.equals(Object) and must be stable after they are returned.

      Parameters:
      parameter - the handler parameter to resolve
      methodAnnotation - the annotation that marks the handler method, if present
      representative - an input representative of the group to be cached
      Returns:
      a stable, complete cache key, or null to 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 true only 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:
      true if 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:
      true if 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 ParameterResolver selection, including any contribution the resolver makes to handler specificity.

      Parameters:
      parameter - the handler parameter to resolve
      methodAnnotation - the annotation that marks the handler method, if present
      representative - an input representative of the cache key returned for this parameter
      Returns:
      an unmatched, rejected, or successfully resolved result