获取类的字段

public static String[] findAllInClassFieldsName(Class l) {
String[] fieldStr = null;
if (l != null) {
Field[] fields = l.getDeclaredFields();
fieldStr = new String[fields.length];
for (int i = 0; i < fields.length; i++) {
fieldStr[i] = fields[i].getName();
}
}
return fieldStr;

}
posted @ 2019-07-06 14:36  zzl0916  阅读(135)  评论(0编辑  收藏  举报