public class JacksonAdapter extends Object implements SerializerAdapter
SerializerAdapter for Jackson.| Constructor and Description |
|---|
JacksonAdapter()
Creates a new JacksonAdapter instance with default mapper settings.
|
| Modifier and Type | Method and Description |
|---|---|
static SerializerAdapter |
createDefaultSerializerAdapter()
maintain singleton instance of the default serializer adapter.
|
<T> T |
deserialize(HttpHeaders headers,
Type deserializedHeadersType)
Deserialize the provided headers returned from a REST API to an entity instance declared as
the model to hold 'Matching' headers.
|
<T> T |
deserialize(String value,
Type type,
SerializerEncoding encoding)
Deserializes a string into a
U object. |
String |
serialize(Object object,
SerializerEncoding encoding)
Serializes an object into a string.
|
String |
serializeList(List<?> list,
CollectionFormat format)
Serializes a list into a string with the delimiter specified with the
Swagger collection format joining each individual serialized items in
the list.
|
com.fasterxml.jackson.databind.ObjectMapper |
serializer() |
String |
serializeRaw(Object object)
Serializes an object into a raw string.
|
protected com.fasterxml.jackson.databind.ObjectMapper |
simpleMapper()
Gets a static instance of
ObjectMapper that doesn't handle flattening. |
public JacksonAdapter()
protected com.fasterxml.jackson.databind.ObjectMapper simpleMapper()
ObjectMapper that doesn't handle flattening.ObjectMapper.public static SerializerAdapter createDefaultSerializerAdapter()
public com.fasterxml.jackson.databind.ObjectMapper serializer()
public String serialize(Object object, SerializerEncoding encoding) throws IOException
SerializerAdapterserialize in interface SerializerAdapterobject - the object to serializeencoding - the encoding to use for serializationIOException - exception from serializationpublic String serializeRaw(Object object)
SerializerAdapterserializeRaw in interface SerializerAdapterobject - the object to serializepublic String serializeList(List<?> list, CollectionFormat format)
SerializerAdapterserializeList in interface SerializerAdapterlist - the list to serializeformat - the Swagger collection formatpublic <T> T deserialize(String value, Type type, SerializerEncoding encoding) throws IOException
SerializerAdapterU object.deserialize in interface SerializerAdapterT - the type of the deserialized objectvalue - the string value to deserializetype - the type to deserializeencoding - the encoding used in the serialized valueIOException - exception from deserializationpublic <T> T deserialize(HttpHeaders headers, Type deserializedHeadersType) throws IOException
SerializerAdapterHeaderCollection annotation applied to
the properties in the entity.ResponseBase returned by java proxy method corresponding to the REST API.
e.g.
Mono<RestResponseBase<FooMetadataHeaders, Void>> getMetadata(args);
class FooMetadataHeaders {
String name;
{@literal @}HeaderCollection("header-collection-prefix-")
Map<String,String> headerCollection;
}
in the case of above example, this method produces an instance of FooMetadataHeaders from provided
headers.deserialize in interface SerializerAdapterT - the type of the deserialized objectheaders - the REST API returned headersdeserializedHeadersType - the type to deserializeheaders, if header entity model does
not exists then return nullIOException - If an I/O error occursCopyright © 2019 Microsoft Corporation. All rights reserved.