Package org.azd.abstractions.serializer
Interface SerializerContext
- All Known Implementing Classes:
JsonSerializer
public interface SerializerContext
Serializes and Deserializes the JSON.
-
Method Summary
Modifier and TypeMethodDescription<T> T
deserialize
(File src, Class<T> valueType) Deserialize JSON string to a specified type.<T> T
deserialize
(InputStream content, Class<T> valueType) Deserialize an input stream to a specified type.<T> T
deserialize
(String content, com.fasterxml.jackson.core.type.TypeReference<T> valueType) Deserialize JSON string to a specified type.<T> T
deserialize
(String content, Class<T> valueType) Deserialize JSON string to a specified type.Serialize an object to JSON string.com.fasterxml.jackson.databind.JsonNode
Serializes JSON string to JSON node.
-
Method Details
-
serialize
Serialize an object to JSON string.- Parameters:
value
- Object to serialize.- Returns:
- JSON string.
- Throws:
AzDException
- Default exception handler.
-
serialize
Serializes JSON string to JSON node.- Parameters:
jsonString
- JSON string to serialize.- Returns:
- JSON node object.
- Throws:
AzDException
- Default exception handler.
-
deserialize
Deserialize JSON string to a specified type.- Type Parameters:
T
- Type parameter- Parameters:
content
- JSON string.valueType
- Type to convert to.- Returns:
- Java object of specified type.
- Throws:
AzDException
- Default exception handler.
-
deserialize
<T> T deserialize(String content, com.fasterxml.jackson.core.type.TypeReference<T> valueType) throws AzDException Deserialize JSON string to a specified type.- Type Parameters:
T
- Type parameter- Parameters:
content
- JSON string.valueType
- Type to convert to.- Returns:
- Java object of specified type.
- Throws:
AzDException
- Default exception handler.
-
deserialize
Deserialize an input stream to a specified type.- Type Parameters:
T
- Type parameter- Parameters:
content
- JSON string.valueType
- Type to convert to.- Returns:
- Java object of specified type.
- Throws:
AzDException
- Default exception handler.
-
deserialize
Deserialize JSON string to a specified type.- Type Parameters:
T
- Type parameter- Parameters:
src
- File that contains JSON string.valueType
- Type to convert to.- Returns:
- Java object of specified type.
- Throws:
AzDException
- Default exception handler.
-