Improve method naming in MethodParameter class [SPR-6055] #10724
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Oliver Drotbohm opened SPR-6055 and commented
Implementing custom
WebArgumentResolver
s you intensively deal with the@MethodParameter
@ parameter you get handed inresolveArgument(..)
. It's API could need some minor improvements to reduce surprises:getAnnotations()
does not return the annotations of the parameter but the annotations of the method. To access the actual parameter annotations you have to callgetParameterAnnotations()
. So I'd suggest to letgetAnnotations()
return the parameter annotations instead, dropgetParameterAnnotations()
and introduce agetMethodAnnotations()
to return the method's annotations.hasAnnotation(Class<? extends Annotation> annotation)
or maybe<T extends Annotation> T getAnnotation(Class<T> annotation)
to access the annotation directly or getnull
if the parameter does not contain the an annotation of the given type. This would save the client from extracting all annotations and teadiously iterating over all of them.Affects: 3.0 M3
The text was updated successfully, but these errors were encountered: