Interface Serializer
- All Known Subinterfaces:
PofContext
- All Known Implementing Classes:
ConfigurablePofContext
,DefaultSerializer
,MultiplexingSerializer
,NullImplementation.NullPofContext
,SafeConfigurablePofContext
,SimplePofContext
Serializer implementations should implement the ClassLoaderAware interface if they need access to a ClassLoader. However, to support hot-deploying containers, it is important that a Serializer not hold any strong references to that ClassLoader, or to any Class objects obtained from that ClassLoader.
Note: it is extremely important that objects that are equivalent according to their "equals()" implementation produce equivalent serialized streams. Violating this relationship will result in non-deterministic behavior for many Coherence services.
- Since:
- Coherence 3.2
- Author:
- cp/jh 2007.07.21
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault Object
Deserialize an object from a ReadBuffer by reading its state using the specified BufferInput object.default <T> T
deserialize
(ReadBuffer.BufferInput in, Class<? extends T> clazz) Deserialize an object as an instance of the specified class by reading its state using the specified BufferInput object.static Map
<String, SerializerFactory> Return aMap
ofSerializerFactory
instances discovered on the class path.static Map
<String, SerializerFactory> discoverSerializers
(ClassLoader loader) Return aMap
ofSerializerFactory
instances discovered on the class path.default String
getName()
Return the name of this serializer.void
serialize
(WriteBuffer.BufferOutput out, Object o) Serialize an object to a WriteBuffer by writing its state using the specified BufferOutput object.
-
Method Details
-
serialize
Serialize an object to a WriteBuffer by writing its state using the specified BufferOutput object.Note: Starting with Coherence 12.2.1 classes that need to designate an alternative object to be used by the Serializer when writing the object to the buffer should implement the
SerializationSupport.writeReplace()
method.- Parameters:
out
- the BufferOutput with which to write the object's stateo
- the object to serialize- Throws:
IOException
- if an I/O error occurs
-
deserialize
Deserialize an object from a ReadBuffer by reading its state using the specified BufferInput object.Note: Starting with Coherence 12.2.1 classes that need to designate an alternative object to be returned by the Serializer after an object is deserialized from the buffer should implement the
SerializationSupport.readResolve()
method.- Parameters:
in
- the BufferInput with which to read the object's state- Returns:
- the deserialized user type instance
- Throws:
IOException
- if an I/O error occurs
-
deserialize
Deserialize an object as an instance of the specified class by reading its state using the specified BufferInput object.Note: Starting with Coherence 12.2.1 classes that need to designate an alternative object to be returned by the Serializer after an object is deserialized from the buffer should implement the
SerializationSupport.readResolve()
method.- Type Parameters:
T
- the class to deserialize to- Parameters:
in
- the BufferInput with which to read the object's stateclazz
- the type of the object to deserialize- Returns:
- the deserialized user type instance
- Throws:
IOException
- if an I/O error occurs- Since:
- 12.2.1.4
-
getName
Return the name of this serializer.- Returns:
- the name of this serializer
- Since:
- 12.2.1.4
-
discoverSerializers
Return aMap
ofSerializerFactory
instances discovered on the class path.- Returns:
- a
Map
ofSerializerFactory
instances discovered on the class path
-
discoverSerializers
Return aMap
ofSerializerFactory
instances discovered on the class path.- Parameters:
loader
- theClassLoader
to use to discover any serializers- Returns:
- a
Map
ofSerializerFactory
instances discovered on the class path
-