Interface Serializer<T>

Type Parameters:
T - the type of the instances to serialize
All Known Subinterfaces:
StatefulSerializer<T>

public interface Serializer<T>
Defines the contract used to transform type instances to and from a serial form.

Implementations must be thread-safe.

When used within the default serialization provider, there is an additional requirement. The implementations must define a constructor that takes in a ClassLoader. The ClassLoader value may be null. If not null, the class loader instance provided should be used during deserialization to load classes needed by the deserialized objects.

The serialized object's class must be preserved; deserialization of the serial form of an object must return an object of the same class. The following contract must always be true:

object.getClass().equals( mySerializer.read(mySerializer.serialize(object)).getClass())

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(T object, ByteBuffer binary)
    Checks if the given instance and serial form represent the same instance.
    read(ByteBuffer binary)
    Reconstructs an instance from the given serial form.
    serialize(T object)
    Transforms the given instance into its serial form.