Here you can find the source of findField(Class classBeFind, String name)
public static Field findField(Class classBeFind, String name)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Field; public class Main { public static Field findField(Class classBeFind, String name) { Field field = null;//w w w . j a v a 2s.c om while (true) { try { field = classBeFind.getDeclaredField(name); } catch (Exception e) { field = null; } if (field != null) { return field; } classBeFind = classBeFind.getSuperclass(); if (classBeFind == null) { return null; } } } }