discomarathon / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

Is there any way to restrict deserialization if certain conditions not full-filled? #317

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1) Suppose if some field / method is deleted from the class OR changed the data 
type and are present in stored JSON format object then it should not 
deserialize it.

2) If some field/method is added then it should deserialize.

Original issue reported on code.google.com by prafull....@gmail.com on 19 Apr 2011 at 8:00

GoogleCodeExporter commented 9 years ago
Have you considered using the versioning support in Gson? If you model changes 
in a drastic way then maybe its better to version your fields.

Original comment by joel.leitch@gmail.com on 3 Jun 2011 at 6:34

GoogleCodeExporter commented 9 years ago
Thanks joel !!
yes i am trying to use it for versioning which can be backward compatible but 
should be only in case of addition of new features not in case of deleting OR 
modifying the fields. otherwise It will give unexpected results which are hard 
to catch.

Original comment by prafull....@gmail.com on 3 Jun 2011 at 6:46

GoogleCodeExporter commented 9 years ago
Closing as WontFix. If you can explain what we should add, please post that 
here. Otherwise custom type adapters should make this easy.

Original comment by limpbizkit on 29 Dec 2011 at 6:00