Interface SerDes
- All Known Implementing Classes:
DurableInputOutputSerDes,FileSystemSerDes,JacksonSerDes
public interface SerDes
-
Method Summary
Modifier and TypeMethodDescription<T> Tdeserialize(String data, TypeToken<T> typeToken) Deserializes a JSON string to an object of the specified generic type.default <T> Tdeserialize(String data, TypeToken<T> typeToken, SerDesContext context) Deserializes an operation payload with its stable execution and entity identity.Serializes an object to a JSON string.default Stringserialize(Object value, SerDesContext context) Serializes an operation payload with its stable execution and entity identity.
-
Method Details
-
serialize
Serializes an object to a JSON string.- Parameters:
value- the object to serialize- Returns:
- the JSON string representation, or null if value is null
-
serialize
Serializes an operation payload with its stable execution and entity identity.The default preserves existing implementations. Override this method when serialization needs external storage. References returned by such implementations must remain readable after later writes for the same entity.
-
deserialize
Deserializes a JSON string to an object of the specified generic type.This method supports complex generic types like
List<MyObject>orMap<String, MyObject>that cannot be represented by a simpleClassobject.Usage example:
List<String> items = serDes.deserialize(json, new TypeToken<List<String>>() {});- Type Parameters:
T- the target type- Parameters:
data- the JSON string to deserializetypeToken- the type token capturing the generic type information- Returns:
- the deserialized object, or null if data is null
-
deserialize
Deserializes an operation payload with its stable execution and entity identity.The default preserves existing implementations. The context identifies the consuming operation; externally produced callback and invoke results may have been serialized with a different context.
-