Browse Source

Polishing

pull/23814/head
Juergen Hoeller 7 years ago
parent
commit
5b9129724b
  1. 9
      spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java
  2. 7
      spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/HandlerMethodArgumentResolverComposite.java
  3. 7
      spring-web/src/main/java/org/springframework/http/HttpStatus.java
  4. 13
      spring-web/src/main/java/org/springframework/web/method/support/HandlerMethodArgumentResolverComposite.java

9
spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -84,8 +84,9 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable @@ -84,8 +84,9 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable
*/
public DependencyDescriptor(MethodParameter methodParameter, boolean required, boolean eager) {
super(methodParameter);
this.declaringClass = methodParameter.getDeclaringClass();
if (this.methodParameter.getMethod() != null) {
if (methodParameter.getMethod() != null) {
this.methodName = methodParameter.getMethod().getName();
this.parameterTypes = methodParameter.getMethod().getParameterTypes();
}
@ -117,6 +118,7 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable @@ -117,6 +118,7 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable
*/
public DependencyDescriptor(Field field, boolean required, boolean eager) {
super(field);
this.declaringClass = field.getDeclaringClass();
this.fieldName = field.getName();
this.required = required;
@ -129,6 +131,7 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable @@ -129,6 +131,7 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable
*/
public DependencyDescriptor(DependencyDescriptor original) {
super(original);
this.declaringClass = original.declaringClass;
this.methodName = original.methodName;
this.parameterTypes = original.parameterTypes;
@ -236,7 +239,7 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable @@ -236,7 +239,7 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable
}
/**
* Build a ResolvableType object for the wrapped parameter/field.
* Build a {@link ResolvableType} object for the wrapped parameter/field.
* @since 4.0
*/
public ResolvableType getResolvableType() {

7
spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/HandlerMethodArgumentResolverComposite.java

@ -45,8 +45,8 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu @@ -45,8 +45,8 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu
/**
* Add the given {@link HandlerMethodArgumentResolver}.
*/
public HandlerMethodArgumentResolverComposite addResolver(HandlerMethodArgumentResolver argumentResolver) {
this.argumentResolvers.add(argumentResolver);
public HandlerMethodArgumentResolverComposite addResolver(HandlerMethodArgumentResolver resolver) {
this.argumentResolvers.add(resolver);
return this;
}
@ -99,8 +99,7 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu @@ -99,8 +99,7 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu
* Iterate over registered
* {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers}
* and invoke the one that supports it.
* @throws IllegalStateException if no suitable
* {@link HandlerMethodArgumentResolver} is found.
* @throws IllegalArgumentException if no suitable argument resolver is found
*/
@Override
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {

7
spring-web/src/main/java/org/springframework/http/HttpStatus.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -431,6 +431,7 @@ public enum HttpStatus { @@ -431,6 +431,7 @@ public enum HttpStatus {
* Whether this status code is in the HTTP series
* {@link org.springframework.http.HttpStatus.Series#INFORMATIONAL}.
* This is a shortcut for checking the value of {@link #series()}.
* @since 4.0
* @see #series()
*/
public boolean is1xxInformational() {
@ -441,6 +442,7 @@ public enum HttpStatus { @@ -441,6 +442,7 @@ public enum HttpStatus {
* Whether this status code is in the HTTP series
* {@link org.springframework.http.HttpStatus.Series#SUCCESSFUL}.
* This is a shortcut for checking the value of {@link #series()}.
* @since 4.0
* @see #series()
*/
public boolean is2xxSuccessful() {
@ -451,6 +453,7 @@ public enum HttpStatus { @@ -451,6 +453,7 @@ public enum HttpStatus {
* Whether this status code is in the HTTP series
* {@link org.springframework.http.HttpStatus.Series#REDIRECTION}.
* This is a shortcut for checking the value of {@link #series()}.
* @since 4.0
* @see #series()
*/
public boolean is3xxRedirection() {
@ -461,6 +464,7 @@ public enum HttpStatus { @@ -461,6 +464,7 @@ public enum HttpStatus {
* Whether this status code is in the HTTP series
* {@link org.springframework.http.HttpStatus.Series#CLIENT_ERROR}.
* This is a shortcut for checking the value of {@link #series()}.
* @since 4.0
* @see #series()
*/
public boolean is4xxClientError() {
@ -471,6 +475,7 @@ public enum HttpStatus { @@ -471,6 +475,7 @@ public enum HttpStatus {
* Whether this status code is in the HTTP series
* {@link org.springframework.http.HttpStatus.Series#SERVER_ERROR}.
* This is a shortcut for checking the value of {@link #series()}.
* @since 4.0
* @see #series()
*/
public boolean is5xxServerError() {

13
spring-web/src/main/java/org/springframework/web/method/support/HandlerMethodArgumentResolverComposite.java

@ -106,10 +106,9 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu @@ -106,10 +106,9 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu
/**
* Iterate over registered
* {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers} and
* invoke the one that supports it.
* @throws IllegalStateException if no suitable
* {@link HandlerMethodArgumentResolver} is found.
* {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers}
* and invoke the one that supports it.
* @throws IllegalArgumentException if no suitable argument resolver is found
*/
@Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
@ -130,9 +129,9 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu @@ -130,9 +129,9 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu
private HandlerMethodArgumentResolver getArgumentResolver(MethodParameter parameter) {
HandlerMethodArgumentResolver result = this.argumentResolverCache.get(parameter);
if (result == null) {
for (HandlerMethodArgumentResolver methodArgumentResolver : this.argumentResolvers) {
if (methodArgumentResolver.supportsParameter(parameter)) {
result = methodArgumentResolver;
for (HandlerMethodArgumentResolver resolver : this.argumentResolvers) {
if (resolver.supportsParameter(parameter)) {
result = resolver;
this.argumentResolverCache.put(parameter, result);
break;
}

Loading…
Cancel
Save