Polishing

This commit is contained in:
Sam Brannen
2019-06-18 10:19:03 +03:00
parent 7f67cecd10
commit aa0a8d66a8
3 changed files with 17 additions and 19 deletions

View File

@@ -85,8 +85,8 @@ public class MappingMediaTypeFileExtensionResolver implements MediaTypeFileExten
}
private void addFileExtension(MediaType mediaType, String extension) {
List<String> list = this.fileExtensions.computeIfAbsent(mediaType, key -> new CopyOnWriteArrayList<>());
list.add(extension);
this.fileExtensions.computeIfAbsent(mediaType, key -> new CopyOnWriteArrayList<>())
.add(extension);
}
@@ -103,7 +103,7 @@ public class MappingMediaTypeFileExtensionResolver implements MediaTypeFileExten
/**
* Use this method for a reverse lookup from extension to MediaType.
* @return a MediaType for the key, or {@code null} if none found
* @return a MediaType for the extension, or {@code null} if none found
*/
@Nullable
protected MediaType lookupMediaType(String extension) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 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.
@@ -21,8 +21,8 @@ import java.util.List;
import org.springframework.http.MediaType;
/**
* Strategy to resolve {@link MediaType} to a list of file extensions.
* For example resolve "application/json" to "json".
* Strategy to resolve a {@link MediaType} to a list of file extensions &mdash;
* for example, to resolve "application/json" to "json".
*
* @author Rossen Stoyanchev
* @since 3.2
@@ -30,14 +30,14 @@ import org.springframework.http.MediaType;
public interface MediaTypeFileExtensionResolver {
/**
* Resolve the given media type to a list of path extensions.
* Resolve the given media type to a list of file extensions.
* @param mediaType the media type to resolve
* @return a list of extensions or an empty list (never {@code null})
*/
List<String> resolveFileExtensions(MediaType mediaType);
/**
* Return all registered file extensions.
* Get all registered file extensions.
* @return a list of extensions or an empty list (never {@code null})
*/
List<String> getAllFileExtensions();