Hello I am looking the way to not setting all values from POJO class one by one. and setter must be invoked in one go.
I have this POJO data.
private int id;
private String newsfeedCategories;
private String lastName;
private String email;
private String mobile;
private String sendNotifications;
private String zipcode;
private String uniounSupplier;
private String unionContractor;
private String password;
private String lastUpdate;
private String deviceType;
private String firstName;
private String unionRep;
private String local;
private String deviceToken;
private String unionLegislator;
private String gender;
private String unionCarpenter;
When I call web service I need to call setter for each value. Is there any other way to set whole data in better and efficiant way.
Below is my code to set POJO
Gson gson = new Gson();
UserData response = new UserData(jObj);
String json = gson.toJson(response);
response = gson.fromJson(json, UserData.class);
/* Data data1 = ParseManager.parseLoginResponse(result);
UserManager.setLoginResponse(data1);
Data d = UserManager.getUer();*/
/* Bundle bundle = getIntent().getExtras();
Data userData = (Data) bundle.getParcelable("email");*/
//Log.e("email Id is","-----------------"+ userData.getEmail());
// here to set the parser class and fetch the result
Data data = new Data();
data.setId(response.getData().getId());
data.setFirstName(response.getData().getFirstName());
data.setLastName(response.getData().getLastName());
data.setMobile(response.getData().getMobile());
data.setEmail(response.getData().getEmail());
data.setZipcode(response.getData().getZipcode());
data.setGender(response.getData().getGender());
data.setPassword(response.getData().getPassword());
data.setUnionCarpenter(response.getData().getUnionCarpenter());
data.setUnionRep(response.getData().getUnionRep());
data.setLocal(response.getData().getLocal());
data.setUnionContractor(response.getData().getUnionContractor());
data.setUnionLegislator(response.getData().getUnionLegislator());
data.setUniounSupplier(response.getData().getUniounSupplier());
data.setNewsfeedCategories(response.getData().getNewsfeedCategories());
data.setSendNotifications(response.getData().getSendNotifications());
data.setLastUpdate(response.getData().getLastUpdate());