我有以下课程:
public class Address {
String customerName;
String emailAddress;
String address1;
int age;
double height;
// .. etc, including getters and setters
}
是否可以以某种方式获取这些字段的HashMap?例如,String name = address.getFields("customerName");
。它会使验证变得更容易。