Class JacksonSerdes

java.lang.Object
dev.restate.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 Link icon

    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 a custom object mapper.
    static <T> Serde<T>
    of(com.fasterxml.jackson.databind.ObjectMapper mapper, Class<T> clazz)
    Serialize/Deserialize class using a custom 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 Link icon

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

    • of Link icon

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

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

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

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