Package io.dapr.client
Class ObjectSerializer
java.lang.Object
io.dapr.client.ObjectSerializer
- Direct Known Subclasses:
ActorObjectSerializer,DefaultObjectSerializer
Serializes and deserializes an internal object.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static com.fasterxml.jackson.databind.ObjectMapperShared Json serializer/deserializer as per Jackson's documentation. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor to avoid class from being instantiated outside package but still inherited. -
Method Summary
Modifier and TypeMethodDescription<T> Tdeserialize(byte[] content, TypeRef<T> type)Deserializes the byte array into the original object.<T> Tdeserialize(byte[] content, Class<T> clazz)Deserializes the byte array into the original object.com.fasterxml.jackson.databind.JsonNodeparseNode(byte[] content)Parses the JSON content into a node for fine-grained processing.byte[]Serializes a given state object into byte array.
-
Field Details
-
OBJECT_MAPPER
protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPERShared Json serializer/deserializer as per Jackson's documentation.
-
-
Constructor Details
-
ObjectSerializer
protected ObjectSerializer()Default constructor to avoid class from being instantiated outside package but still inherited.
-
-
Method Details
-
serialize
Serializes a given state object into byte array.- Parameters:
state- State object to be serialized.- Returns:
- Array of bytes[] with the serialized content.
- Throws:
IOException- In case state cannot be serialized.
-
deserialize
Deserializes the byte array into the original object.- Type Parameters:
T- Generic type of the object being deserialized.- Parameters:
content- Content to be parsed.type- Type of the object being deserialized.- Returns:
- Object of type T.
- Throws:
IOException- In case content cannot be deserialized.
-
deserialize
Deserializes the byte array into the original object.- Type Parameters:
T- Generic type of the object being deserialized.- Parameters:
content- Content to be parsed.clazz- Type of the object being deserialized.- Returns:
- Object of type T.
- Throws:
IOException- In case content cannot be deserialized.
-
parseNode
Parses the JSON content into a node for fine-grained processing.- Parameters:
content- JSON content.- Returns:
- JsonNode.
- Throws:
IOException- In case content cannot be parsed.
-