Class VersionFieldSerializer<T>

  • All Implemented Interfaces:
    java.util.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:
    TaggedFieldSerializer
    • Field Detail

      • typeVersion

        private int typeVersion
      • fieldVersion

        private int[] fieldVersion
      • compatible

        private boolean compatible
    • Constructor Detail

      • VersionFieldSerializer

        public VersionFieldSerializer​(Kryo kryo,
                                      java.lang.Class type)
      • VersionFieldSerializer

        public VersionFieldSerializer​(Kryo kryo,
                                      java.lang.Class type,
                                      boolean compatible)