Skip to content

Commit 61579ff

Browse files
committed
Polishing
1 parent b474916 commit 61579ff

File tree

12 files changed

+43
-54
lines changed

12 files changed

+43
-54
lines changed

spring-test/src/main/java/org/springframework/test/context/web/AbstractGenericWebContextLoader.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ protected void configureWebResources(GenericWebApplicationContext context,
190190
}
191191
else {
192192
ServletContext servletContext = null;
193-
194193
// Find the root WebApplicationContext
195194
while (parent != null) {
196195
if (parent instanceof WebApplicationContext && !(parent.getParent() instanceof WebApplicationContext)) {
@@ -199,7 +198,7 @@ protected void configureWebResources(GenericWebApplicationContext context,
199198
}
200199
parent = parent.getParent();
201200
}
202-
Assert.state(servletContext != null, "Failed to find Root WebApplicationContext in the context hierarchy");
201+
Assert.state(servletContext != null, "Failed to find root WebApplicationContext in the context hierarchy");
203202
context.setServletContext(servletContext);
204203
}
205204
}

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/SyncHandlerMethodArgumentResolver.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@ default Mono<Object> resolveArgument(
5252
* @return the resolved value, if any
5353
*/
5454
@Nullable
55-
Object resolveArgumentValue(MethodParameter parameter, BindingContext bindingContext,
56-
ServerWebExchange exchange);
55+
Object resolveArgumentValue(
56+
MethodParameter parameter, BindingContext bindingContext, ServerWebExchange exchange);
5757

5858
}

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueSyncArgumentResolver.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,15 +38,14 @@
3838
public abstract class AbstractNamedValueSyncArgumentResolver extends AbstractNamedValueArgumentResolver
3939
implements SyncHandlerMethodArgumentResolver {
4040

41-
4241
/**
4342
* @param factory a bean factory to use for resolving ${...}
4443
* placeholder and #{...} SpEL expressions in default values;
4544
* or {@code null} if default values are not expected to have expressions
4645
* @param registry for checking reactive type wrappers
4746
*/
48-
protected AbstractNamedValueSyncArgumentResolver(@Nullable ConfigurableBeanFactory factory,
49-
ReactiveAdapterRegistry registry) {
47+
protected AbstractNamedValueSyncArgumentResolver(
48+
@Nullable ConfigurableBeanFactory factory, ReactiveAdapterRegistry registry) {
5049

5150
super(factory, registry);
5251
}
@@ -65,8 +64,8 @@ public Mono<Object> resolveArgument(
6564
}
6665

6766
@Override
68-
public Object resolveArgumentValue(MethodParameter parameter, BindingContext context,
69-
ServerWebExchange exchange) {
67+
public Object resolveArgumentValue(
68+
MethodParameter parameter, BindingContext context, ServerWebExchange exchange) {
7069

7170
// This won't block since resolveName below doesn't
7271
return resolveArgument(parameter, context, exchange).block();

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/MatrixVariableMapMethodArgumentResolver.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
/**
4141
* Resolves arguments of type {@link Map} annotated with {@link MatrixVariable @MatrixVariable}
4242
* where the annotation does not specify a name. In other words the purpose of this resolver
43-
* is to provide access to multiple matrix variables, either all or associted with a specific
43+
* is to provide access to multiple matrix variables, either all or associated with a specific
4444
* path variable.
4545
*
4646
* <p>When a name is specified, an argument of type Map is considered to be a single attribute
@@ -53,7 +53,6 @@
5353
public class MatrixVariableMapMethodArgumentResolver extends HandlerMethodArgumentResolverSupport
5454
implements SyncHandlerMethodArgumentResolver {
5555

56-
5756
public MatrixVariableMapMethodArgumentResolver(ReactiveAdapterRegistry registry) {
5857
super(registry);
5958
}
@@ -62,7 +61,7 @@ public MatrixVariableMapMethodArgumentResolver(ReactiveAdapterRegistry registry)
6261
@Override
6362
public boolean supportsParameter(MethodParameter parameter) {
6463
return checkAnnotatedParamNoReactiveWrapper(parameter, MatrixVariable.class,
65-
(annot, type) -> (Map.class.isAssignableFrom(type) && !StringUtils.hasText(annot.name())));
64+
(ann, type) -> (Map.class.isAssignableFrom(type) && !StringUtils.hasText(ann.name())));
6665
}
6766

6867
@Nullable
@@ -113,4 +112,4 @@ private boolean isSingleValueMap(MethodParameter parameter) {
113112
return false;
114113
}
115114

116-
}
115+
}

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/MatrixVariableMethodArgumentResolver.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.web.reactive.result.method.annotation;
1718

1819
import java.util.ArrayList;
@@ -48,9 +49,8 @@
4849
*/
4950
public class MatrixVariableMethodArgumentResolver extends AbstractNamedValueSyncArgumentResolver {
5051

51-
52-
protected MatrixVariableMethodArgumentResolver(@Nullable ConfigurableBeanFactory factory,
53-
ReactiveAdapterRegistry registry) {
52+
public MatrixVariableMethodArgumentResolver(
53+
@Nullable ConfigurableBeanFactory factory, ReactiveAdapterRegistry registry) {
5454

5555
super(factory, registry);
5656
}
@@ -59,7 +59,7 @@ protected MatrixVariableMethodArgumentResolver(@Nullable ConfigurableBeanFactory
5959
@Override
6060
public boolean supportsParameter(MethodParameter parameter) {
6161
return checkAnnotatedParamNoReactiveWrapper(parameter, MatrixVariable.class,
62-
(annot, type) -> !Map.class.isAssignableFrom(type) || StringUtils.hasText(annot.name()));
62+
(ann, type) -> !Map.class.isAssignableFrom(type) || StringUtils.hasText(ann.name()));
6363
}
6464

6565

@@ -73,10 +73,8 @@ protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
7373
@Nullable
7474
@Override
7575
protected Object resolveNamedValue(String name, MethodParameter param, ServerWebExchange exchange) {
76-
7776
Map<String, MultiValueMap<String, String>> pathParameters =
7877
exchange.getAttribute(HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE);
79-
8078
if (CollectionUtils.isEmpty(pathParameters)) {
8179
return null;
8280
}

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelArgumentResolver.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@
2121
import org.springframework.core.MethodParameter;
2222
import org.springframework.core.ReactiveAdapterRegistry;
2323
import org.springframework.ui.Model;
24-
import org.springframework.util.Assert;
2524
import org.springframework.web.reactive.BindingContext;
2625
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport;
2726
import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver;
@@ -49,8 +48,8 @@ public boolean supportsParameter(MethodParameter parameter) {
4948
}
5049

5150
@Override
52-
public Object resolveArgumentValue(MethodParameter parameter, BindingContext context,
53-
ServerWebExchange exchange) {
51+
public Object resolveArgumentValue(
52+
MethodParameter parameter, BindingContext context, ServerWebExchange exchange) {
5453

5554
Class<?> type = parameter.getParameterType();
5655
if (Model.class.isAssignableFrom(type)) {

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,13 +53,13 @@ public boolean supportsParameter(MethodParameter parameter) {
5353
}
5454

5555
private boolean allVariables(PathVariable pathVariable, Class<?> type) {
56-
return Map.class.isAssignableFrom(type) && !StringUtils.hasText(pathVariable.value());
56+
return (Map.class.isAssignableFrom(type) && !StringUtils.hasText(pathVariable.value()));
5757
}
5858

5959

6060
@Override
61-
public Object resolveArgumentValue(MethodParameter methodParameter, BindingContext context,
62-
ServerWebExchange exchange) {
61+
public Object resolveArgumentValue(
62+
MethodParameter methodParameter, BindingContext context, ServerWebExchange exchange) {
6363

6464
String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE;
6565
return exchange.getAttributeOrDefault(name, Collections.emptyMap());

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolver.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -60,14 +60,12 @@ private boolean allParams(RequestHeader annotation, Class<?> type) {
6060

6161

6262
@Override
63-
public Object resolveArgumentValue(MethodParameter methodParameter,
64-
BindingContext context, ServerWebExchange exchange) {
65-
66-
Class<?> paramType = methodParameter.getParameterType();
67-
boolean isMultiValueMap = MultiValueMap.class.isAssignableFrom(paramType);
63+
public Object resolveArgumentValue(
64+
MethodParameter methodParameter, BindingContext context, ServerWebExchange exchange) {
6865

66+
boolean isMultiValueMap = MultiValueMap.class.isAssignableFrom(methodParameter.getParameterType());
6967
HttpHeaders headers = exchange.getRequest().getHeaders();
70-
return isMultiValueMap ? headers : headers.toSingleValueMap();
68+
return (isMultiValueMap ? headers : headers.toSingleValueMap());
7169
}
7270

7371
}

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -47,7 +47,6 @@
4747
public class RequestParamMapMethodArgumentResolver extends HandlerMethodArgumentResolverSupport
4848
implements SyncHandlerMethodArgumentResolver {
4949

50-
5150
public RequestParamMapMethodArgumentResolver(ReactiveAdapterRegistry adapterRegistry) {
5251
super(adapterRegistry);
5352
}
@@ -59,17 +58,17 @@ public boolean supportsParameter(MethodParameter param) {
5958
}
6059

6160
private boolean allParams(RequestParam requestParam, Class<?> type) {
62-
return Map.class.isAssignableFrom(type) && !StringUtils.hasText(requestParam.name());
61+
return (Map.class.isAssignableFrom(type) && !StringUtils.hasText(requestParam.name()));
6362
}
6463

6564

6665
@Override
67-
public Object resolveArgumentValue(MethodParameter methodParameter, BindingContext context,
68-
ServerWebExchange exchange) {
66+
public Object resolveArgumentValue(
67+
MethodParameter methodParameter, BindingContext context, ServerWebExchange exchange) {
6968

7069
boolean isMultiValueMap = MultiValueMap.class.isAssignableFrom(methodParameter.getParameterType());
7170
MultiValueMap<String, String> queryParams = exchange.getRequest().getQueryParams();
72-
return isMultiValueMap ? queryParams : queryParams.toSingleValueMap();
71+
return (isMultiValueMap ? queryParams : queryParams.toSingleValueMap());
7372
}
7473

7574
}

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolver.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,6 @@
2525
import org.springframework.core.MethodParameter;
2626
import org.springframework.core.ReactiveAdapterRegistry;
2727
import org.springframework.http.HttpMethod;
28-
import org.springframework.http.HttpRequest;
2928
import org.springframework.http.server.reactive.ServerHttpRequest;
3029
import org.springframework.http.server.reactive.ServerHttpResponse;
3130
import org.springframework.lang.Nullable;
@@ -80,8 +79,8 @@ public boolean supportsParameter(MethodParameter parameter) {
8079
}
8180

8281
@Override
83-
public Object resolveArgumentValue(MethodParameter methodParameter, BindingContext context,
84-
ServerWebExchange exchange) {
82+
public Object resolveArgumentValue(
83+
MethodParameter methodParameter, BindingContext context, ServerWebExchange exchange) {
8584

8685
Class<?> paramType = methodParameter.getParameterType();
8786
if (ServerWebExchange.class.isAssignableFrom(paramType)) {

0 commit comments

Comments
 (0)