use of com.hazelcast.nio.serialization.TypedDataSerializable in project hazelcast by hazelcast.
the class DataSerializableSerializer method write.
@Override
public void write(ObjectDataOutput out, DataSerializable obj) throws IOException {
// If you ever change the way this is serialized think about to change
// BasicOperationService::extractOperationCallId
final boolean identified = obj instanceof IdentifiedDataSerializable;
out.writeBoolean(identified);
if (identified) {
final IdentifiedDataSerializable ds = (IdentifiedDataSerializable) obj;
out.writeInt(ds.getFactoryId());
out.writeInt(ds.getId());
} else {
if (obj instanceof TypedDataSerializable) {
out.writeUTF(((TypedDataSerializable) obj).getClassType().getName());
} else {
out.writeUTF(obj.getClass().getName());
}
}
obj.writeData(out);
}
Aggregations