Class InputParameterResolver

java.lang.Object
io.fluxzero.sdk.tracking.handling.InputParameterResolver
All Implemented Interfaces:
ParameterResolver<Object>

public class InputParameterResolver extends Object implements ParameterResolver<Object>
Resolves handler method parameters by simply injecting the input if the parameter type is assignable from the input type.
  • Constructor Details

    • InputParameterResolver

      public InputParameterResolver()
  • Method Details

    • resolve

      public Function<Object,Object> resolve(Parameter parameter, Annotation methodAnnotation)
      Description copied from interface: ParameterResolver
      Resolves a Parameter of a handler method into a value function based on the given message.

      If the parameter cannot be resolved by this resolver and ParameterResolver.matches(Parameter, Annotation, M) is not implemented, this method must return null.

      Specified by:
      resolve in interface ParameterResolver<Object>
      Parameters:
      parameter - the parameter to resolve
      methodAnnotation - the annotation present on the handler method (e.g., @HandleEvent)
      Returns:
      a function that takes a message and returns a value to be injected into the method parameter, or null if the parameter cannot be resolved and ParameterResolver.matches(Parameter, Annotation, M) is not implemented.
    • matches

      public boolean matches(Parameter parameter, Annotation methodAnnotation, Object value)
      Description copied from interface: ParameterResolver
      Indicates whether the resolved value is compatible with the declared parameter type.

      This method helps determine whether the parameter can be injected for a given message. It first invokes ParameterResolver.resolve(Parameter, Annotation) and then verifies that the returned value (if any) is assignable to the parameter type.

      Specified by:
      matches in interface ParameterResolver<Object>
      Parameters:
      parameter - the parameter being checked
      methodAnnotation - the annotation on the handler method
      value - the message instance to use for resolution
      Returns:
      true if the parameter can be resolved and assigned to, false otherwise