I want to use modelmapper on my project. I know how can I use modelmapper on basic level.
There is my Entity classes:
public class User {
private String userId;
private String name;
private AccountType accountType;
}
public class AccountType {
private int id;
private String name;
}
And there is my response class:
public class UserModel {
private String userId;
private String name;
private boolean accountType;
}
So what I want?
response: {
"userId": "12345",
"name": "Gokhan",
"accountType": false
}
I want to convert this response to following:
User: {
"userId": "12345",
"name": "Gokhan",
"AccountType " : {
"id" : "2"
"name" : "",
}
}
I mean,
if(response.accountType)
user.getAccountTpe.setId(1);
else user.getAccountTpe.setId(2);
NOTE: I wrote "User" in JSON format in the end. But I need it in JAVA.