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 theCompactSerializationConfig
.write(CompactWriter, Object)
andread(CompactReader)
methods must be consistent with each other.- Since:
- 5.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Class<T>
getCompactClass()
java.lang.String
getTypeName()
Returns the unique type name for the classCompactSerializer
.T
read(CompactReader reader)
void
write(CompactWriter writer, T object)
-
-
-
Method Detail
-
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 ontoobject
- to be serialized.- Throws:
HazelcastSerializationException
- in case of failure to write
-
getTypeName
@Nonnull java.lang.String getTypeName()
Returns the unique type name for the classCompactSerializer
.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 java.lang.Class<T> getCompactClass()
- Returns:
- the class to be serialized with this serializer.
-
-