fixed support for -1 parameterIndex to access the method return type

master
Andy Clement 16 years ago
parent aced98bf23
commit 5a0522e203
  1. 5
      org.springframework.core/src/main/java/org/springframework/core/MethodParameter.java

@ -37,6 +37,7 @@ import org.springframework.util.Assert;
*
* @author Juergen Hoeller
* @author Rob Harrop
* @author Andy Clement
* @since 2.0
* @see GenericCollectionTypeResolver
*/
@ -176,10 +177,14 @@ public class MethodParameter {
*/
public Class getParameterType() {
if (this.parameterType == null) {
if (parameterIndex < 0) {
this.parameterType = (this.method !=null ? this.method.getReturnType():null);
} else {
this.parameterType = (this.method != null ?
this.method.getParameterTypes()[this.parameterIndex] :
this.constructor.getParameterTypes()[this.parameterIndex]);
}
}
return this.parameterType;
}

Loading…
Cancel
Save