There is a class
public class A { public Integer field; } As in runtime, assign to the field the value of a string of the type given to the desired type:
A a = new A(); String field = "field"; String value = "123"; a.getClass().getField(field).set(a, /*value*/ ); // КАК?!
switchas field suits? - post_zeew