Class JacksonXmlSerdes
java.lang.Object
io.github.cjstehno.testthings.serdes.JacksonXmlSerdes
- All Implemented Interfaces:
SerdesProvider
A
SerdesProvider
that uses the Jackson XML data format for serialization and deserialization.-
Constructor Summary
ConstructorDescriptionCreates an instance with the default configuredXmlMapper
. -
Method Summary
Modifier and TypeMethodDescription<T> T
deserialize
(byte[] bytes, Class<? extends T> type) Deserializes the byte array to an object of the specified type.<T> T
deserialize
(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.serializeToString
(Object object) Serialize the object to a string.toString()
-
Constructor Details
-
JacksonXmlSerdes
public JacksonXmlSerdes()Creates an instance with the default configuredXmlMapper
.
-
-
Method Details
-
serializeToBytes
Description copied from interface:SerdesProvider
Serialize the object to bytes.- Specified by:
serializeToBytes
in interfaceSerdesProvider
- Parameters:
object
- the object- Returns:
- a byte array containing the serialized object
- Throws:
IOException
- if there is a problem
-
serializeToString
Description copied from interface:SerdesProvider
Serialize the object to a string.- Specified by:
serializeToString
in interfaceSerdesProvider
- Parameters:
object
- the object- Returns:
- a string containing the serialized object
- Throws:
IOException
- if there is a problem
-
deserialize
Description copied from interface:SerdesProvider
Deserializes the byte array to an object of the specified type.- Specified by:
deserialize
in interfaceSerdesProvider
- 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
Description copied from interface:SerdesProvider
Deserializes the string to an object of the specified type.- Specified by:
deserialize
in interfaceSerdesProvider
- 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
-
toString
-