Java tutorial
//package com.java2s; import java.lang.reflect.Field; import java.util.ArrayList; public class Main { public static ArrayList<String> getFields(Class<?> cls) { ArrayList<String> fieldList = new ArrayList<String>(); Field[] fields = cls.getDeclaredFields(); for (Field f : fields) { fieldList.add(f.getName()); } return fieldList; } }