Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Google Gson Interview Questions and Answers

Ques. What is Versioning Support in Gson?
This is excellent feature you can use, if the class file you are working has been modified in different versions and fields has been annotated with @Since. All you need to do is to use setVersion() method of GsonBuilder.

GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.registerTypeAdapter(Date.class, new DateSerializer());
gsonBuilder.registerTypeAdapter(Date.class, new DateDeserializer());
//Specify the version like this
Gson gson = gsonBuilder.create();

Fields added in various versions in Employee.java
public class Employee
   private Integer id;
   private String firstName;
   private String lastName;
   private List<String> roles;
   private Date birthDate;
   //Setters and Getters

Now test the version feature:
//Using version 1.0 fields
//Using version 1.1 fields
//Using version 1.2 fields
Is it helpful? Yes No

Most helpful rated by users:

©2016 WithoutBook