AnnotatedMethodArgumentResolver class final

Resolves parameters of handler methods annotated with request parameter annotations in JetLeaf's web request handling system.

An AnnotatedMethodArgumentResolver is responsible for:

This resolver allows developers to define custom parameter resolution strategies using annotations on method parameters, enabling a clean separation between controller logic and request parsing.

Resolution Workflow

  1. Annotation Discovery: Collects all direct annotations on a parameter.
  2. Type Matching: Checks if an annotation is a RequestParameter or is meta-annotated with RequestParameter.
  3. Resolver Extraction: Looks for a ResolvedBy annotation on the annotation class to retrieve the resolver instance.
  4. Value Resolution: Uses the resolver to extract the argument value from the incoming request.
  5. Returns null if no suitable resolver is found.

Example

class UserController {
  void getUser(
    @RequestParam('id') String id,
    @RequestParam('verbose') bool verbose
  ) {}
}

final resolver = AnnotatedMethodArgumentResolver();
final param = HandlerMethod(UserController.getUser).getParameter('id');
final value = await resolver.resolveArgument(param, request, response, handler);

Design Notes

  • This class is stateless and can be reused across multiple requests.
  • Supports annotation-driven parameter resolution via RequestParameter and ResolvedBy.
  • Reflection failures while inspecting annotation metadata are silently ignored, ensuring robust request handling.
  • Designed for internal use in the JetLeaf request dispatch pipeline.
Implemented types

Constructors

AnnotatedMethodArgumentResolver(ResolverContext _context)
Resolves parameters of handler methods annotated with request parameter annotations in JetLeaf's web request handling system.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

canResolve(Parameter param) bool
Returns true if this resolver supports the given param.
override
getResolver(Source source) Resolver?
Retrieves the Resolver associated with a given source (parameter).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveArgument(Parameter param, ServerHttpRequest req, ServerHttpResponse res, HandlerMethod handler, [Object? ex, StackTrace? st]) Future<Object?>
Resolves the argument value for the given param.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited