Here you can find the source of findField(Class> clazz, String name)
public static Field findField(Class<?> clazz, String name)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Field; public class Main { public static Field findField(Class<?> clazz, String name) { try {/* w ww.jav a 2 s . c om*/ return clazz.getDeclaredField(name); } catch (NoSuchFieldException e) { if (clazz.getSuperclass() != null) { return findField(clazz.getSuperclass(), name); } return null; } } }