public class Jackson2JsonEncoder extends AbstractJackson2Codec implements Encoder<Object>
Object
stream to a byte stream of JSON objects,
using Jackson 2.6+.Jackson2JsonDecoder
JSON_MIME_TYPES, JSON_VIEW_HINT, mapper
Constructor and Description |
---|
Jackson2JsonEncoder() |
Jackson2JsonEncoder(ObjectMapper mapper) |
Modifier and Type | Method and Description |
---|---|
boolean |
canEncode(ResolvableType elementType,
MimeType mimeType)
Whether the encoder supports the given source element type and the MIME
type for the output stream.
|
reactor.core.publisher.Flux<DataBuffer> |
encode(org.reactivestreams.Publisher<?> inputStream,
DataBufferFactory bufferFactory,
ResolvableType elementType,
MimeType mimeType,
Map<String,Object> hints)
Encode a stream of Objects of type
T into a DataBuffer
output stream. |
List<MimeType> |
getEncodableMimeTypes()
Return the list of mime types this encoder supports.
|
getJavaType
public Jackson2JsonEncoder()
public Jackson2JsonEncoder(ObjectMapper mapper)
public boolean canEncode(ResolvableType elementType, MimeType mimeType)
Encoder
public List<MimeType> getEncodableMimeTypes()
Encoder
getEncodableMimeTypes
in interface Encoder<Object>
public reactor.core.publisher.Flux<DataBuffer> encode(org.reactivestreams.Publisher<?> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)
Encoder
T
into a DataBuffer
output stream.encode
in interface Encoder<Object>
inputStream
- the input stream of Objects to encode. If the input should be
encoded as a single value rather than as a stream of elements, an instance of
Mono
should be used.bufferFactory
- for creating output stream DataBuffer
'selementType
- the expected type of elements in the input stream;
this type must have been previously passed to the Encoder.canEncode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
method and it must have returned true
.mimeType
- the MIME type for the output streamhints
- additional information about how to do encode