http://hi.baidu.com/wangenglishklx/item/4633fce5e1b967138d3ea82b
import java.lang.reflect.Field;
import java.util.Arrays;
public class Test {
public static void main(String[] args) {
Field[] customerProperties = Customer.class.getDeclaredFields();
System.out.println("The fields are : "+Arrays.toString(customerProperties));
for(int i = 0; i < customerProperties.length; i++) {
System.out.print(customerProperties[i].getName()+" ");
}
}
bean 属性名不能用private, 不加修饰符就可以了
import java.lang.reflect.Field;
Field[] fields = TypeAVCReply.class.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
Object value = fields[i].get(avcReply);
if(value == null){
fields[i].set(avcReply, "");
}
}