Class VersionFieldSerializer<T>

All Implemented Interfaces:
Comparator<FieldSerializer.CachedField>

public class VersionFieldSerializer<T> extends FieldSerializer<T,FieldSerializerConfig>
Serializes objects using direct field assignment, with versioning backward compatibility. Allows fields to have a @Since(int) annotation to indicate the version they were added. For a particular field, the value in @Since should never change once created. This is less flexible than FieldSerializer, which can handle most classes without needing annotations, but it provides backward compatibility. This means that new fields can be added, but removing, renaming or changing the type of any field will invalidate previous serialized bytes. VersionFieldSerializer has very little overhead (a single additional varint) compared to FieldSerializer. Forward compatibility is not supported.
See Also:
  • Field Details

    • typeVersion

      private int typeVersion
    • fieldVersion

      private int[] fieldVersion
    • compatible

      private boolean compatible
  • Constructor Details

    • VersionFieldSerializer

      public VersionFieldSerializer(Kryo kryo, Class type)
    • VersionFieldSerializer

      public VersionFieldSerializer(Kryo kryo, Class type, boolean compatible)
  • Method Details