Class TypedParameterResolver<M>

java.lang.Object
io.fluxzero.common.handling.TypedParameterResolver<M>
Type Parameters:
M - the message or context type used for resolution (e.g. HasMessage, Object, etc.)
All Implemented Interfaces:
ParameterResolver<M>
Direct Known Subclasses:
CurrentUserParameterResolver, MetadataParameterResolver, UserParameterResolver

public abstract class TypedParameterResolver<M> extends Object implements ParameterResolver<M>
Abstract base class for ParameterResolvers that resolve parameters based on type matching.

This class provides a default matches(Parameter, Annotation, M) implementation that checks whether the expected type of the parameter is assignable from a configured base type.

  • Constructor Details

    • TypedParameterResolver

      public TypedParameterResolver()
  • Method Details

    • matches

      public boolean matches(Parameter parameter, Annotation methodAnnotation, M value)
      Determines whether the given parameter is eligible to be resolved by this resolver.

      This default implementation matches if parameter.getType() is assignable from the configured base type.

      Specified by:
      matches in interface ParameterResolver<M>
      Parameters:
      parameter - the method parameter to resolve
      methodAnnotation - the annotation on the method (if any)
      value - the current message or context object
      Returns:
      true if this resolver can resolve the parameter
    • mayApply

      public boolean mayApply(Executable method, Class<?> targetClass)
      Determines whether this resolver may be applicable to the given method or constructor.
      Specified by:
      mayApply in interface ParameterResolver<M>
      Parameters:
      method - the handler method or constructor
      targetClass - the declaring or target class
      Returns:
      true if this resolver could apply, false otherwise