Minor Jackson encoder/decoder refactoring

Consolidate JsonView hint extraction in shared base class.

Rename base class from AbstractJackson2Codec to Jackson2CodecSupport
since the class mainly provides support methods.
This commit is contained in:
Rossen Stoyanchev
2017-03-21 14:48:36 -04:00
parent 35805995c2
commit d0e0b6c8c9
8 changed files with 81 additions and 86 deletions

View File

@@ -29,7 +29,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.codec.json.AbstractJackson2Codec;
import org.springframework.http.codec.json.Jackson2CodecSupport;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.web.reactive.function.BodyInserter;
import org.springframework.web.reactive.function.BodyInserters;
@@ -207,7 +207,7 @@ public interface EntityResponse<T> extends ServerResponse {
Builder<T> contentType(MediaType contentType);
/**
* Add a serialization hint like {@link AbstractJackson2Codec#JSON_VIEW_HINT} to
* Add a serialization hint like {@link Jackson2CodecSupport#JSON_VIEW_HINT} to
* customize how the body will be serialized.
* @param key the hint key
* @param value the hint value

View File

@@ -32,7 +32,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpRange;
import org.springframework.http.MediaType;
import org.springframework.http.codec.json.AbstractJackson2Codec;
import org.springframework.http.codec.json.Jackson2CodecSupport;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.reactive.function.BodyExtractor;
import org.springframework.web.server.WebSession;
@@ -82,7 +82,7 @@ public interface ServerRequest {
/**
* Extract the body with the given {@code BodyExtractor} and hints.
* @param extractor the {@code BodyExtractor} that reads from the request
* @param hints the map of hints like {@link AbstractJackson2Codec#JSON_VIEW_HINT}
* @param hints the map of hints like {@link Jackson2CodecSupport#JSON_VIEW_HINT}
* to use to customize body extraction
* @param <T> the type of the body returned
* @return the extracted body

View File

@@ -31,7 +31,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.codec.json.AbstractJackson2Codec;
import org.springframework.http.codec.json.Jackson2CodecSupport;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.util.Assert;
import org.springframework.web.reactive.function.BodyInserter;
@@ -326,7 +326,7 @@ public interface ServerResponse {
BodyBuilder contentType(MediaType contentType);
/**
* Add a serialization hint like {@link AbstractJackson2Codec#JSON_VIEW_HINT}
* Add a serialization hint like {@link Jackson2CodecSupport#JSON_VIEW_HINT}
* to customize how the body will be serialized.
* @param key the hint key
* @param value the hint value

View File

@@ -50,7 +50,7 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
import org.springframework.util.MultiValueMap;
import static org.junit.Assert.*;
import static org.springframework.http.codec.json.AbstractJackson2Codec.*;
import static org.springframework.http.codec.json.Jackson2CodecSupport.*;
/**
* @author Arjen Poutsma

View File

@@ -61,7 +61,7 @@ import org.springframework.util.MultiValueMap;
import static java.nio.charset.StandardCharsets.*;
import static org.junit.Assert.*;
import static org.springframework.http.codec.json.AbstractJackson2Codec.*;
import static org.springframework.http.codec.json.Jackson2CodecSupport.*;
/**
* @author Arjen Poutsma