Here you can find the source of findField(final Class> currentClass, final String fieldName)
static Field findField(final Class<?> currentClass, final String fieldName)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Field; public class Main { static Field findField(final Class<?> currentClass, final String fieldName) { if (null == currentClass) { return null; }// ww w . ja v a 2s . c o m for (final Field cf : currentClass.getDeclaredFields()) { if (fieldName.equals(cf.getName())) { return cf; } } return findField(currentClass.getSuperclass(), fieldName); } }