How to add field into class with deserialization compatibility using Protostuff?

151 Views Asked by At

I have an immutable object of class

class A {
   public A(B b) {
       this.a = b.c;
   }

   @Tag(1)
   final int a;
}

How to add field into class with backward binary deserialization compatibility using Protostuff without writing custom deserializers if it possible?

1

There are 1 best solutions below

1
On

Always append new fields in your class rather than insert them in the middle of the fields.

refer to official document