Skip to content

Commit beae336

Browse files
committed
Polishing
1 parent e7dde74 commit beae336

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

spring-context/src/main/java/org/springframework/cache/interceptor/CacheResolver.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -23,7 +23,7 @@
2323
/**
2424
* Determine the {@link Cache} instance(s) to use for an intercepted method invocation.
2525
*
26-
* <p>Implementations MUST be thread-safe.
26+
* <p>Implementations must be thread-safe.
2727
*
2828
* @author Stephane Nicoll
2929
* @since 4.1
@@ -32,9 +32,8 @@ public interface CacheResolver {
3232

3333
/**
3434
* Return the cache(s) to use for the specified invocation.
35-
*
3635
* @param context the context of the particular invocation
37-
* @return the cache(s) to use (never null)
36+
* @return the cache(s) to use (never {@code null})
3837
*/
3938
Collection<? extends Cache> resolveCaches(CacheOperationInvocationContext<?> context);
4039

spring-web/src/main/java/org/springframework/http/ResponseEntity.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,8 @@ public interface HeadersBuilder<B extends HeadersBuilder<B>> {
322322
/**
323323
* Set the caching directives for the resource, as specified by the
324324
* {@code Cache-Control} header.
325-
*
326325
* <p>A {@code CacheControl} instance can be built like
327326
* {@code CacheControl.maxAge(3600).cachePublic().noTransform()}.
328-
*
329327
* @param cacheControl the instance that builds cache related HTTP response headers
330328
* @return this builder
331329
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2">RFC-7234 Section 5.2</a>
@@ -441,7 +439,7 @@ public BodyBuilder location(URI location) {
441439
@Override
442440
public BodyBuilder cacheControl(CacheControl cacheControl) {
443441
String ccValue = cacheControl.getHeaderValue();
444-
if(ccValue != null) {
442+
if (ccValue != null) {
445443
this.headers.setCacheControl(cacheControl.getHeaderValue());
446444
}
447445
return this;

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
*
5050
* @author Arjen Poutsma
5151
* @author Rossen Stoyanchev
52+
* @author Brian Clozel
5253
* @since 3.1
5354
*/
5455
public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodProcessor {
@@ -59,25 +60,27 @@ public HttpEntityMethodProcessor(List<HttpMessageConverter<?>> messageConverters
5960

6061
public HttpEntityMethodProcessor(List<HttpMessageConverter<?>> messageConverters,
6162
ContentNegotiationManager contentNegotiationManager) {
63+
6264
super(messageConverters, contentNegotiationManager);
6365
}
6466

6567
public HttpEntityMethodProcessor(List<HttpMessageConverter<?>> messageConverters,
6668
ContentNegotiationManager contentNegotiationManager, List<Object> responseBodyAdvice) {
69+
6770
super(messageConverters, contentNegotiationManager, responseBodyAdvice);
6871
}
6972

7073

7174
@Override
7275
public boolean supportsParameter(MethodParameter parameter) {
73-
return HttpEntity.class.equals(parameter.getParameterType()) ||
74-
RequestEntity.class.equals(parameter.getParameterType());
76+
return (HttpEntity.class.equals(parameter.getParameterType()) ||
77+
RequestEntity.class.equals(parameter.getParameterType()));
7578
}
7679

7780
@Override
7881
public boolean supportsReturnType(MethodParameter returnType) {
79-
return HttpEntity.class.isAssignableFrom(returnType.getParameterType()) &&
80-
!RequestEntity.class.isAssignableFrom(returnType.getParameterType());
82+
return (HttpEntity.class.isAssignableFrom(returnType.getParameterType()) &&
83+
!RequestEntity.class.isAssignableFrom(returnType.getParameterType()));
8184
}
8285

8386
@Override
@@ -142,17 +145,17 @@ public void handleReturnValue(Object returnValue, MethodParameter returnType,
142145
Object body = responseEntity.getBody();
143146
if (responseEntity instanceof ResponseEntity) {
144147
if (isResourceNotModified(webRequest, (ResponseEntity<?>) responseEntity)) {
145-
// Ensure headers are flushed, no body should be written
148+
// Ensure headers are flushed, no body should be written.
146149
outputMessage.flush();
147-
// skip call to converters, as they may update the body
150+
// Skip call to converters, as they may update the body.
148151
return;
149152
}
150153
}
151154

152155
// Try even with null body. ResponseBodyAdvice could get involved.
153156
writeWithMessageConverters(body, returnType, inputMessage, outputMessage);
154157

155-
// Ensure headers are flushed even if no body was written
158+
// Ensure headers are flushed even if no body was written.
156159
outputMessage.flush();
157160
}
158161

0 commit comments

Comments
 (0)