@Experimental public interface ValueSerializer
ServiceLoader
mechanism.
Clients can than elect to use the registered format by sending a HandshakeRequest with
and setting the valueFormat field in the request to match the string returned by getID()
If clients elect to use this ValueSerializer, all values that are sent as an EncodedValue
can be sent as EncodedValue.customObjectResult. The server will use the
deserialize(ByteString)
method to deserialize them. When the server is sending values
to the client, it will use serialize(Object)
to serialize the value and send the
response to the client as a EncodedValue.customObjectResult.
Implementations should be *threadsafe*. No guarantees are made about whether the server will
create one or more instances of this serializer or how they will be shared amongst server
threads.
init(Cache)
will be called before the serialize(Object)
and
deserialize(ByteString)
.Modifier and Type | Method and Description |
---|---|
Object |
deserialize(com.google.protobuf.ByteString bytes)
Deserialize bytes that are sent from the client into an object.
|
String |
getID()
Unique identifier for this serializer.
|
void |
init(Cache cache)
Initialize this serializer.
|
com.google.protobuf.ByteString |
serialize(Object object)
Serialize an object into bytes that can be sent to a client.
|
default boolean |
supportsPrimitives()
True if this serializer wants to serialize all values, including primitives like
numbers and strings that can be sent as one of the options in EncodedValue.
|
com.google.protobuf.ByteString serialize(Object object) throws IOException
object
- Object to serialize, which may be null if is true
.
If the
object to be sent is serialized in PDX form, this object may be a PdxInstance
,
even if GemFireCache.getPdxReadSerialized()
is falseIOException
Object deserialize(com.google.protobuf.ByteString bytes) throws IOException, ClassNotFoundException
PdxInstance
for PDX data to avoid having to actually have classes
present on the server.bytes
- the bytes to deserialize. Will not be null.IOException
ClassNotFoundException
void init(Cache cache)
String getID()
default boolean supportsPrimitives()