Here you can find the source of findField(Class> claz, String... names)
public static Field findField(Class<?> claz, String... names)
//package com.java2s; //License from project: LGPL import java.lang.reflect.Field; public class Main { public static Field findField(Class<?> claz, String... names) { Exception e = null;//from www. j a v a 2 s .co m Class<?> clas = claz; while (claz != null) { for (String name : names) { try { return clas.getDeclaredField(name); } catch (Exception ee) { e = ee; } } clas = claz.getSuperclass(); } throw new IllegalArgumentException(e); } }