Interface HandlerMethodPlanner<M>

Type Parameters:
M - the message type used by the handling pipeline

public interface HandlerMethodPlanner<M>
Selects and prepares a handler method so that the result can be reused for equivalent inputs.

This is an advanced extension point for handler matchers and parameter resolvers. A planner must account for every input property that can affect method selection, argument resolution, or handler specificity. If it cannot do so safely, it should return null from getCacheKey(Object) or return HandlerMethodPreparation.unsupported(); Fluxzero will then use normal per-message handler selection.

  • Method Details

    • prepareApplicability

      default HandlerMethodApplicability<M> prepareApplicability(M message)
      Determines whether a handler applies to the message and returns the complete key needed to reuse that decision.
      Parameters:
      message - a representative message
      Returns:
      the prepared applicability, or an unsupported result when it cannot be cached safely
    • prepareApplicability

      default HandlerMethodApplicability<M> prepareApplicability(HandlerInput<M> input)
      Determines whether a handler applies without creating the complete message when the planner supports lazy input.
      Parameters:
      input - a representative handler input
      Returns:
      the prepared applicability, or an unsupported result when it cannot be cached safely
    • getCacheKey

      Object getCacheKey(M message)
      Returns a key containing every message property that can affect the result of prepare(Object).

      Keys are compared using Object.equals(Object) and must remain stable after they are returned. Equal keys must always produce an equivalent match decision and invocation plan.

      Parameters:
      message - a representative message
      Returns:
      a complete reusable key, or null when this message cannot be cached safely
    • getCacheKey

      default Object getCacheKey(HandlerInput<M> input)
      Returns the complete key without creating the message when the planner supports lazy input.

      The default implementation delegates to getCacheKey(Object) and therefore creates the message.

      Parameters:
      input - a representative handler input
      Returns:
      a complete reusable key, or null when this input cannot be cached safely
    • prepare

      HandlerMethodPreparation<M> prepare(M message)
      Selects a handler method for the representative message and prepares its invocation.
      Parameters:
      message - a representative message
      Returns:
      a prepared plan, a definitive non-match, or an unsupported result
    • prepare

      default HandlerMethodPreparation<M> prepare(HandlerInput<M> input)
      Selects and prepares a handler method without creating the message when the planner supports lazy input.

      The default implementation delegates to prepare(Object) and therefore creates the message.

      Parameters:
      input - a representative handler input
      Returns:
      a prepared plan, a definitive non-match, or an unsupported result
    • isPayloadClassKey

      default boolean isPayloadClassKey(HandlerInput<M> input)
      Returns whether the payload's runtime class alone completely determines a successful preparation for this input.
      Returns:
      true if the prepared match may be reused for every payload of the same runtime class
    • isNoMatchPayloadClassKey

      default boolean isNoMatchPayloadClassKey(HandlerInput<M> input)
      Returns whether the payload's runtime class alone completely determines a non-match for this input.
      Returns:
      true if the non-match may be reused for every payload of the same runtime class