Skip to content

Commit d4b0751

Browse files
committed
Polishing
1 parent 6bed180 commit d4b0751

File tree

3 files changed

+33
-42
lines changed

3 files changed

+33
-42
lines changed

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

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -284,16 +284,15 @@ public MediaType(String type, String subtype) {
284284
* Create a new {@code MediaType} for the given type, subtype, and character set.
285285
* @param type the primary type
286286
* @param subtype the subtype
287-
* @param charSet the character set
287+
* @param charset the character set
288288
* @throws IllegalArgumentException if any of the parameters contain illegal characters
289289
*/
290-
public MediaType(String type, String subtype, Charset charSet) {
291-
this(type, subtype, Collections.singletonMap(PARAM_CHARSET, charSet.name()));
290+
public MediaType(String type, String subtype, Charset charset) {
291+
this(type, subtype, Collections.singletonMap(PARAM_CHARSET, charset.name()));
292292
}
293293

294294
/**
295295
* Create a new {@code MediaType} for the given type, subtype, and quality value.
296-
*
297296
* @param type the primary type
298297
* @param subtype the subtype
299298
* @param qualityValue the quality value
@@ -774,18 +773,18 @@ public static String toString(Collection<MediaType> mediaTypes) {
774773
* Sorts the given list of {@code MediaType} objects by specificity.
775774
* <p>Given two media types:
776775
* <ol>
777-
* <li>if either media type has a {@linkplain #isWildcardType() wildcard type}, then the media type without the
778-
* wildcard is ordered before the other.</li>
779-
* <li>if the two media types have different {@linkplain #getType() types}, then they are considered equal and
780-
* remain their current order.</li>
781-
* <li>if either media type has a {@linkplain #isWildcardSubtype() wildcard subtype}, then the media type without
782-
* the wildcard is sorted before the other.</li>
783-
* <li>if the two media types have different {@linkplain #getSubtype() subtypes}, then they are considered equal
784-
* and remain their current order.</li>
785-
* <li>if the two media types have different {@linkplain #getQualityValue() quality value}, then the media type
786-
* with the highest quality value is ordered before the other.</li>
787-
* <li>if the two media types have a different amount of {@linkplain #getParameter(String) parameters}, then the
788-
* media type with the most parameters is ordered before the other.</li>
776+
* <li>if either media type has a {@linkplain #isWildcardType() wildcard type}, then the media type without the
777+
* wildcard is ordered before the other.</li>
778+
* <li>if the two media types have different {@linkplain #getType() types}, then they are considered equal and
779+
* remain their current order.</li>
780+
* <li>if either media type has a {@linkplain #isWildcardSubtype() wildcard subtype}, then the media type without
781+
* the wildcard is sorted before the other.</li>
782+
* <li>if the two media types have different {@linkplain #getSubtype() subtypes}, then they are considered equal
783+
* and remain their current order.</li>
784+
* <li>if the two media types have different {@linkplain #getQualityValue() quality value}, then the media type
785+
* with the highest quality value is ordered before the other.</li>
786+
* <li>if the two media types have a different amount of {@linkplain #getParameter(String) parameters}, then the
787+
* media type with the most parameters is ordered before the other.</li>
789788
* </ol>
790789
* <p>For example:
791790
* <blockquote>audio/basic &lt; audio/* &lt; *&#047;*</blockquote>
@@ -807,18 +806,18 @@ public static void sortBySpecificity(List<MediaType> mediaTypes) {
807806
* Sorts the given list of {@code MediaType} objects by quality value.
808807
* <p>Given two media types:
809808
* <ol>
810-
* <li>if the two media types have different {@linkplain #getQualityValue() quality value}, then the media type
811-
* with the highest quality value is ordered before the other.</li>
812-
* <li>if either media type has a {@linkplain #isWildcardType() wildcard type}, then the media type without the
813-
* wildcard is ordered before the other.</li>
814-
* <li>if the two media types have different {@linkplain #getType() types}, then they are considered equal and
815-
* remain their current order.</li>
816-
* <li>if either media type has a {@linkplain #isWildcardSubtype() wildcard subtype}, then the media type without
817-
* the wildcard is sorted before the other.</li>
818-
* <li>if the two media types have different {@linkplain #getSubtype() subtypes}, then they are considered equal
819-
* and remain their current order.</li>
820-
* <li>if the two media types have a different amount of {@linkplain #getParameter(String) parameters}, then the
821-
* media type with the most parameters is ordered before the other.</li>
809+
* <li>if the two media types have different {@linkplain #getQualityValue() quality value}, then the media type
810+
* with the highest quality value is ordered before the other.</li>
811+
* <li>if either media type has a {@linkplain #isWildcardType() wildcard type}, then the media type without the
812+
* wildcard is ordered before the other.</li>
813+
* <li>if the two media types have different {@linkplain #getType() types}, then they are considered equal and
814+
* remain their current order.</li>
815+
* <li>if either media type has a {@linkplain #isWildcardSubtype() wildcard subtype}, then the media type without
816+
* the wildcard is sorted before the other.</li>
817+
* <li>if the two media types have different {@linkplain #getSubtype() subtypes}, then they are considered equal
818+
* and remain their current order.</li>
819+
* <li>if the two media types have a different amount of {@linkplain #getParameter(String) parameters}, then the
820+
* media type with the most parameters is ordered before the other.</li>
822821
* </ol>
823822
* @param mediaTypes the list of media types to be sorted
824823
* @see #getQualityValue()

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 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.
@@ -33,7 +33,6 @@ public interface HandlerMethodArgumentResolver {
3333
/**
3434
* Whether the given {@linkplain MethodParameter method parameter} is
3535
* supported by this resolver.
36-
*
3736
* @param parameter the method parameter to check
3837
* @return {@code true} if this resolver supports the supplied parameter;
3938
* {@code false} otherwise
@@ -46,7 +45,6 @@ public interface HandlerMethodArgumentResolver {
4645
* request. A {@link WebDataBinderFactory} provides a way to create
4746
* a {@link WebDataBinder} instance when needed for data binding and
4847
* type conversion purposes.
49-
*
5048
* @param parameter the method parameter to resolve. This parameter must
5149
* have previously been passed to
5250
* {@link #supportsParameter(org.springframework.core.MethodParameter)}
@@ -57,9 +55,7 @@ public interface HandlerMethodArgumentResolver {
5755
* @return the resolved argument value, or {@code null}.
5856
* @throws Exception in case of errors with the preparation of argument values
5957
*/
60-
Object resolveArgument(MethodParameter parameter,
61-
ModelAndViewContainer mavContainer,
62-
NativeWebRequest webRequest,
63-
WebDataBinderFactory binderFactory) throws Exception;
58+
Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
59+
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception;
6460

6561
}

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 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.
@@ -31,7 +31,6 @@ public interface HandlerMethodReturnValueHandler {
3131
/**
3232
* Whether the given {@linkplain MethodParameter method return type} is
3333
* supported by this handler.
34-
*
3534
* @param returnType the method return type to check
3635
* @return {@code true} if this handler supports the supplied return type;
3736
* {@code false} otherwise
@@ -43,7 +42,6 @@ public interface HandlerMethodReturnValueHandler {
4342
* setting a view or setting the
4443
* {@link ModelAndViewContainer#setRequestHandled} flag to {@code true}
4544
* to indicate the response has been handled directly.
46-
*
4745
* @param returnValue the value returned from the handler method
4846
* @param returnType the type of the return value. This type must have
4947
* previously been passed to
@@ -53,9 +51,7 @@ public interface HandlerMethodReturnValueHandler {
5351
* @param webRequest the current request
5452
* @throws Exception if the return value handling results in an error
5553
*/
56-
void handleReturnValue(Object returnValue,
57-
MethodParameter returnType,
58-
ModelAndViewContainer mavContainer,
59-
NativeWebRequest webRequest) throws Exception;
54+
void handleReturnValue(Object returnValue, MethodParameter returnType,
55+
ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception;
6056

6157
}

0 commit comments

Comments
 (0)