Polish "Provide a public API for resolving the type of a field"

Closes gh-549
This commit is contained in:
Andy Wilkinson
2018-11-21 14:17:03 +00:00
parent 4453fde23c
commit 64ea9c29f5
3 changed files with 8 additions and 8 deletions

View File

@@ -19,26 +19,27 @@ package org.springframework.restdocs.payload;
import org.springframework.http.MediaType;
/**
* Public abstraction for external access to field type determination for xml and json
* payloads.
* Resolves the type of a field in a request or response payload.
*
* @author Mathias Düsterhöft
* @author Andy Wilkinson
* @since 2.0.3
*/
public interface FieldTypeResolver {
/**
* Create a FieldTypeResolver for the given content and contentType.
* @param content the payload that the {@link FieldTypeResolver} should handle
* Create a {@code FieldTypeResolver} for the given {@code content} and
* {@code contentType}.
* @param content the payload that the {@code FieldTypeResolver} should handle
* @param contentType the content type of the payload
* @return the {@link FieldTypeResolver}
* @return the {@code FieldTypeResolver}
*/
static FieldTypeResolver forContent(byte[] content, MediaType contentType) {
return ContentHandler.forContent(content, contentType);
}
/**
* Returns the type of the field that is described by the given
* Resolves the type of the field that is described by the given
* {@code fieldDescriptor} based on the content of the payload.
* @param fieldDescriptor the field descriptor
* @return the type of the field

View File

@@ -34,7 +34,7 @@ import org.springframework.restdocs.payload.JsonFieldProcessor.ExtractedField;
* @author Andy Wilkinson
* @author Mathias Düsterhöft
*/
class JsonContentHandler implements ContentHandler, FieldTypeResolver {
class JsonContentHandler implements ContentHandler {
private final JsonFieldProcessor fieldProcessor = new JsonFieldProcessor();

View File

@@ -30,7 +30,6 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.subsecti
* Tests for {@link XmlContentHandler}.
*
* @author Andy Wilkinson
* @author Mathias Düsterhöft
*/
public class XmlContentHandlerTests {