How do I set the values of POJO properties that exist in both POJO and Map objects?
For example, I have this POJO class:
public class User {
private int id;
private String name;
private String address;
// getters/setters
}
User user = new User();
user.setId(1);
user.setName("Julez");
user.setAddress("Southwood City");
And I have this Map:
Map<String, String> map = new HashMap<>();
map.put("address", "Eastwood City");
Since User class has address, and Map has key address, I'd like to set the value of address as Eastwood City. There might be a possibility that the Map would also have key id, name, a combination of two or all of the User properties.
Edit: User object has already been created and all properties have values. In the above example, the address Eastwood City should be replaced by Southwood City.