Skip to content

Commit 60fac67

Browse files
committed
Polish
1 parent 612a63c commit 60fac67

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ public class MediaType extends MimeType implements Serializable {
370370

371371
private static final String PARAM_QUALITY_FACTOR = "q";
372372

373-
374373
static {
375374
// Not using "valueOf' to avoid static init cost
376375
ALL = new MediaType("*", "*");
@@ -401,7 +400,6 @@ public class MediaType extends MimeType implements Serializable {
401400
TEXT_XML = new MediaType("text", "xml");
402401
}
403402

404-
405403
/**
406404
* Create a new {@code MediaType} for the given primary type.
407405
* <p>The {@linkplain #getSubtype() subtype} is set to "&#42;", parameters empty.
@@ -479,6 +477,14 @@ public MediaType(String type, String subtype, @Nullable Map<String, String> para
479477
super(type, subtype, parameters);
480478
}
481479

480+
/**
481+
* Create a new {@code MediaType} for the given {@link MimeType}.
482+
* The type, subtype and parameters information is copied and {@code MediaType}-specific
483+
* checks on parameters are performed.
484+
* @param mimeType the MIME type
485+
* @throws IllegalArgumentException if any of the parameters contain illegal characters
486+
* @since 5.3.0
487+
*/
482488
public MediaType(MimeType mimeType) {
483489
super(mimeType);
484490
this.getParameters().forEach(this::checkParameters);
@@ -653,7 +659,7 @@ else if (mediaTypes.size() == 1) {
653659
*/
654660
public static List<MediaType> asMediaTypes(List<MimeType> mimeTypes) {
655661
List<MediaType> mediaTypes = new ArrayList<>(mimeTypes.size());
656-
for(MimeType mimeType : mimeTypes) {
662+
for (MimeType mimeType : mimeTypes) {
657663
mediaTypes.add(MediaType.asMediaType(mimeType));
658664
}
659665
return mediaTypes;

0 commit comments

Comments
 (0)