提交 5a0522e2 编写于 作者: A Andy Clement

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

上级 aced98bf
...@@ -37,6 +37,7 @@ import org.springframework.util.Assert; ...@@ -37,6 +37,7 @@ import org.springframework.util.Assert;
* *
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Rob Harrop * @author Rob Harrop
* @author Andy Clement
* @since 2.0 * @since 2.0
* @see GenericCollectionTypeResolver * @see GenericCollectionTypeResolver
*/ */
...@@ -176,9 +177,13 @@ public class MethodParameter { ...@@ -176,9 +177,13 @@ public class MethodParameter {
*/ */
public Class getParameterType() { public Class getParameterType() {
if (this.parameterType == null) { if (this.parameterType == null) {
this.parameterType = (this.method != 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.method.getParameterTypes()[this.parameterIndex] :
this.constructor.getParameterTypes()[this.parameterIndex]); this.constructor.getParameterTypes()[this.parameterIndex]);
}
} }
return this.parameterType; return this.parameterType;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册