Interface SerdesProvider
- All Known Implementing Classes:
JacksonJsonSerdes,JacksonXmlSerdes,JavaObjectSerdes
public interface SerdesProvider
An interface to allow for different serialization/deserialization framework implementations to use the same
testing framework methods.
An implementation MUST support the
serializeToBytes(Object) and deserialize(byte[],Class)
methods - the String-related methods are optional since some serialization formats do not support clean string
representations.-
Method Summary
Modifier and TypeMethodDescription<T> Tdeserialize(byte[] bytes, Class<? extends T> type) Deserializes the byte array to an object of the specified type.default <T> Tdeserialize(String string, Class<? extends T> type) Deserializes the string to an object of the specified type.byte[]serializeToBytes(Object object) Serialize the object to bytes.default StringserializeToString(Object object) Serialize the object to a string.
-
Method Details
-
serializeToBytes
Serialize the object to bytes.- Parameters:
object- the object- Returns:
- a byte array containing the serialized object
- Throws:
IOException- if there is a problem
-
serializeToString
Serialize the object to a string.- Parameters:
object- the object- Returns:
- a string containing the serialized object
- Throws:
IOException- if there is a problem
-
deserialize
Deserializes the byte array to an object of the specified type.- Type Parameters:
T- the type of object- Parameters:
bytes- the byte arraytype- the object type- Returns:
- the object instance
- Throws:
IOException- if there is a problem
-
deserialize
Deserializes the string to an object of the specified type.- Type Parameters:
T- the type of object- Parameters:
string- the stringtype- the object type- Returns:
- the object instance
- Throws:
IOException- if there is a problem
-