public class JsonInstanceSerializer<T> extends java.lang.Object implements InstanceSerializer<T>
Constructor and Description |
---|
JsonInstanceSerializer(java.lang.Class<T> payloadClass) |
Modifier and Type | Method and Description |
---|---|
ServiceInstance<T> |
deserialize(byte[] bytes)
Deserialize a byte array into an instance
|
byte[] |
serialize(ServiceInstance<T> instance)
Serialize an instance into bytes
|
public JsonInstanceSerializer(java.lang.Class<T> payloadClass)
payloadClass
- used to validate payloads when deserializingpublic ServiceInstance<T> deserialize(byte[] bytes) throws java.lang.Exception
InstanceSerializer
deserialize
in interface InstanceSerializer<T>
bytes
- the bytesjava.lang.Exception
- any errorspublic byte[] serialize(ServiceInstance<T> instance) throws java.lang.Exception
InstanceSerializer
serialize
in interface InstanceSerializer<T>
instance
- the instancejava.lang.Exception
- any errors