All:
I have a data model object in Java like:
class Model {
String name;
String email;
}
What I want to do is dynamically determine what attribute I want to set by using a variable like in Javascript object;
String field = "name";
// This is what I try to achieve, not the real code.
New Model().field = "according content";
or
New Model()[field] = "according content";
Thanks