Android examples for java.lang.reflect:Field
get Declared Fields Include Inherit
//package com.java2s; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; public class Main { public static List<Field[]> getDeclaredFieldsIncludeInherit( Class<?> clazz) { List<Field[]> list = new ArrayList<Field[]>(); for (Class<?> c = clazz; c != null; c = c.getSuperclass()) { Field[] fields = c.getDeclaredFields(); list.add(fields);/* w w w . j a v a 2 s . c o m*/ } return list; } }