/** * Creates a new {@link MethodParameters} for the given {@link Method} and {@link AnnotationAttribute}. If the latter * is given, method parameter names will be looked up from the annotation attribute if present. * * @param method must not be {@literal null}. * @param namingAnnotation must not be {@literal null}. */ public MethodParameters(Method method, Optional<AnnotationAttribute> namingAnnotation) { Assert.notNull(method, "Method must not be null!"); this.parameters = new ArrayList<>(); for (int i = 0; i < method.getParameterCount(); i++) { MethodParameter parameter = new AnnotationNamingMethodParameter(method, i, namingAnnotation); parameter.initParameterNameDiscovery(discoverer); parameters.add(parameter); } }