Class JacksonSerdes

java.lang.Object
dev.restate.sdk.serde.jackson.JacksonSerdes

public final class JacksonSerdes extends Object
Serde implementations for Jackson.

You can use these serdes for serializing and deserializing state, side effects results and awakeables using Jackson's ObjectMapper.

For example:


 private static final StateKey<Person> PERSON = StateKey.of("person", JacksonSerdes.of(Person.class));
 
Or using Jackson's TypeReference to encapsulate generics:

 private static final StateKey<List<Person>> PEOPLE = StateKey.of("people", JacksonSerdes.of(new TypeReference<>() {}));
 
When no object mapper is provided, a default one is used, using the default JsonFactory and discovering SPI modules.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> Serde<T>
    of(com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
    Serialize/Deserialize TypeReference using the default object mapper.
    static <T> Serde<T>
    of(com.fasterxml.jackson.databind.ObjectMapper mapper, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
    Serialize/Deserialize TypeReference using the default object mapper.
    static <T> Serde<T>
    of(com.fasterxml.jackson.databind.ObjectMapper mapper, Class<T> clazz)
    Serialize/Deserialize class using the provided object mapper.
    static <T> Serde<T>
    of(Class<T> clazz)
    Serialize/Deserialize class using the default object mapper.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • of

      public static <T> Serde<T> of(Class<T> clazz)
      Serialize/Deserialize class using the default object mapper.
    • of

      public static <T> Serde<T> of(com.fasterxml.jackson.databind.ObjectMapper mapper, Class<T> clazz)
      Serialize/Deserialize class using the provided object mapper.
    • of

      public static <T> Serde<T> of(com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
      Serialize/Deserialize TypeReference using the default object mapper.
    • of

      public static <T> Serde<T> of(com.fasterxml.jackson.databind.ObjectMapper mapper, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
      Serialize/Deserialize TypeReference using the default object mapper.