Here you can find the source of findField(Object propertyId, Class classOfItem)
public static Field findField(Object propertyId, Class classOfItem)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Field; public class Main { public static Field findField(Object propertyId, Class classOfItem) { Field declaredField;/*from w w w. ja v a 2 s. c o m*/ try { declaredField = classOfItem.getDeclaredField(String.valueOf(propertyId)); } catch (NoSuchFieldException e) { declaredField = null; } if (declaredField == null && !Object.class.equals(classOfItem)) return findField(propertyId, classOfItem.getSuperclass()); return declaredField; } }