Class JacksonModelSerializer<T>
java.lang.Object
org.apache.curator.x.async.modeled.JacksonModelSerializer<T>
- All Implemented Interfaces:
ModelSerializer<T>
Model serializer that uses Jackson for JSON serialization. IMPORTANT:
the jackson dependency is specified as
provided
in the curator-x-async Maven POM
file to avoid adding a new dependency to Curator. Therefore, if you wish to use the
JacksonModelSerializer you must manually add the dependency to your build system-
Field Summary
Fields inherited from interface org.apache.curator.x.async.modeled.ModelSerializer
raw
-
Constructor Summary
ConstructorDescriptionJacksonModelSerializer
(com.fasterxml.jackson.core.type.TypeReference type) JacksonModelSerializer
(com.fasterxml.jackson.databind.JavaType type) JacksonModelSerializer
(com.fasterxml.jackson.databind.ObjectMapper mapper, com.fasterxml.jackson.core.type.TypeReference type) JacksonModelSerializer
(com.fasterxml.jackson.databind.ObjectMapper mapper, com.fasterxml.jackson.databind.JavaType type) JacksonModelSerializer
(com.fasterxml.jackson.databind.ObjectReader reader, com.fasterxml.jackson.databind.ObjectWriter writer) JacksonModelSerializer
(Class<T> modelClass) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> JacksonModelSerializer
<T> build
(com.fasterxml.jackson.core.type.TypeReference type) static <T> JacksonModelSerializer
<T> build
(com.fasterxml.jackson.databind.JavaType type) static <T> JacksonModelSerializer
<T> deserialize
(byte[] bytes) Given bytes serialized viaModelSerializer.serialize(Object)
return the modelbyte[]
Given a model return the serialized bytes
-
Constructor Details
-
JacksonModelSerializer
-
JacksonModelSerializer
public JacksonModelSerializer(com.fasterxml.jackson.databind.JavaType type) -
JacksonModelSerializer
public JacksonModelSerializer(com.fasterxml.jackson.core.type.TypeReference type) -
JacksonModelSerializer
public JacksonModelSerializer(com.fasterxml.jackson.databind.ObjectMapper mapper, com.fasterxml.jackson.databind.JavaType type) -
JacksonModelSerializer
public JacksonModelSerializer(com.fasterxml.jackson.databind.ObjectMapper mapper, com.fasterxml.jackson.core.type.TypeReference type) -
JacksonModelSerializer
public JacksonModelSerializer(com.fasterxml.jackson.databind.ObjectReader reader, com.fasterxml.jackson.databind.ObjectWriter writer)
-
-
Method Details
-
build
-
build
-
build
public static <T> JacksonModelSerializer<T> build(com.fasterxml.jackson.core.type.TypeReference type) -
serialize
Description copied from interface:ModelSerializer
Given a model return the serialized bytes- Specified by:
serialize
in interfaceModelSerializer<T>
- Parameters:
model
- model- Returns:
- bytes
-
deserialize
Description copied from interface:ModelSerializer
Given bytes serialized viaModelSerializer.serialize(Object)
return the model- Specified by:
deserialize
in interfaceModelSerializer<T>
- Parameters:
bytes
- serialized bytes- Returns:
- model
-