Package com.azure.cosmos
Class CosmosItemSerializer
java.lang.Object
com.azure.cosmos.CosmosItemSerializer
The
CosmosItemSerializer
allows customizing the serialization of Cosmos Items - either to transform payload (for
example wrap/unwrap in custom envelopes) or use custom serialization settings or json serializer stacks.-
Field Summary
Modifier and TypeFieldDescriptionstatic final CosmosItemSerializer
Gets the default Cosmos item serializer. -
Constructor Summary
-
Method Summary
-
Field Details
-
DEFAULT_SERIALIZER
Gets the default Cosmos item serializer. This serializer is used by default when no custom serializer is specified on request options or theCosmosClientBuilder
-
-
Constructor Details
-
CosmosItemSerializer
protected CosmosItemSerializer()Used to instantiate subclasses
-
-
Method Details
-
serialize
Used to serialize a POJO into a json tree- Type Parameters:
T
- The type of the POJO- Parameters:
item
- the POJO to be serialized- Returns:
- the json tree that will be used as payload in Cosmos DB items
-
deserialize
Used to deserialize the json tree stored in the Cosmos DB item as a POJO- Type Parameters:
T
- The type of the POJO- Parameters:
jsonNodeMap
- the json tree from the Cosmos DB itemclassType
- The type of the POJO- Returns:
- The deserialized POJO
-