Interface CompactSerializer<T>

Type Parameters:
T - Type of the serialized/deserialized class
All Known Implementing Classes:
ObjectIdCompactSerializer

public interface CompactSerializer<T>
Defines the contract of the serializers used for Compact serialization.

After defining a serializer for the objects of the class T, it can be registered using the CompactSerializationConfig.

write(CompactWriter, Object) and read(CompactReader) methods must be consistent with each other.

Since:
5.2
  • Method Details

    • read

      @Nonnull T read(@Nonnull CompactReader reader)
      Parameters:
      reader - reader to read fields of an object
      Returns:
      the object created as a result of read method
      Throws:
      HazelcastSerializationException - in case of failure to read
    • write

      void write(@Nonnull CompactWriter writer, @Nonnull T object)
      Parameters:
      writer - CompactWriter to serialize the fields onto
      object - to be serialized.
      Throws:
      HazelcastSerializationException - in case of failure to write
    • getTypeName

      @Nonnull String getTypeName()
      Returns the unique type name for the class CompactSerializer.

      If the class CompactSerializer is ever evolved by adding or removing fields, the type name for the evolved serializers must be the same with the initial version.

      Returns:
      the type name
    • getCompactClass

      @Nonnull Class<T> getCompactClass()
      Returns:
      the class to be serialized with this serializer.