InstanceSerializer<T>public class JsonInstanceSerializer<T> extends java.lang.Object implements InstanceSerializer<T>
| Constructor | Description |
|---|---|
JsonInstanceSerializer(java.lang.Class<T> payloadClass) |
CURATOR-275 introduced a new field into
ServiceInstance. |
JsonInstanceSerializer(java.lang.Class<T> payloadClass,
boolean compatibleSerializationMode) |
CURATOR-275 introduced a new field into
ServiceInstance. |
| Modifier and Type | Method | 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)
ServiceInstance. This caused a potential
UnrecognizedPropertyException in older clients that
read newly serialized ServiceInstances. Therefore the default behavior of JsonInstanceSerializer
has been changed to NOT serialize the enabled field. If you wish to use that field, use the
alternate constructor JsonInstanceSerializer(Class, boolean) and pass true for
compatibleSerializationMode. Note: future versions of Curator may change this
behavior.payloadClass - used to validate payloads when deserializingpublic JsonInstanceSerializer(java.lang.Class<T> payloadClass, boolean compatibleSerializationMode)
ServiceInstance. This caused a potential
UnrecognizedPropertyException in older clients that
read newly serialized ServiceInstances. If you are susceptible to this you should set the
serializer to be an instance of JsonInstanceSerializer
with compatibleSerializationMode set to true. IMPORTANT: when this is done, the new enabled
field of ServiceInstance is not serialized. If however you do want
to use the enabled field, set compatibleSerializationMode to false.payloadClass - used to validate payloads when deserializingcompatibleSerializationMode - pass true to serialize in a manner that supports clients pre-CURATOR-275public ServiceInstance<T> deserialize(byte[] bytes) throws java.lang.Exception
InstanceSerializerdeserialize in interface InstanceSerializer<T>bytes - the bytesjava.lang.Exception - any errorspublic byte[] serialize(ServiceInstance<T> instance) throws java.lang.Exception
InstanceSerializerserialize in interface InstanceSerializer<T>instance - the instancejava.lang.Exception - any errorsCopyright © 2011–2018 The Apache Software Foundation. All rights reserved.