src/main/java/com/rockagen/commons/util/ClassUtil.java
public static Field getDeclaredField(Class<?> clazz, String fieldName,
			boolean recursively) {
		try {
			return clazz.getDeclaredField(fieldName);
		} catch (NoSuchFieldException e) {
			Class<?> superClass = clazz.getSuperclass();
			if (superClass != null && recursively) {
				return getDeclaredField(superClass, fieldName, true);
			}
		} catch (SecurityException e) {
			log.error("{}",e.getMessage(),e);
		}
		return null;

	}
public static Field getDeclaredField(Class<?> clazz, String fieldName,
			boolean recursively) {
		try {
			return clazz.getDeclaredField(fieldName);
		} catch (NoSuchFieldException e) {
			Class<?> superClass = clazz.getSuperclass();
			if (superClass != null && recursively) {
				return getDeclaredField(superClass, fieldName, true);
			}
		} catch (SecurityException e) {
			log.error("{}",e.getMessage(),e);
		}
		return null;

	}
public static Field getDeclaredField ( Class < ? > clazz , String fieldName , boolean recursively ) { try { return clazz . getDeclaredField ( fieldName ) ; } catch ( NoSuchFieldException e ) { Class < ? > superClass = clazz . getSuperclass ( ) ; if ( superClass != null && recursively ) { return getDeclaredField ( superClass , fieldName , true ) ; } } catch ( SecurityException e ) { log . error ( "{}" , e . getMessage ( ) , e ) ; } return null ; }
obtain field If recursively is true, obtain fields from all class
hierarchy

@param clazz class
where fields are searching
@param fieldName
field name
@param recursively
param
@return list of fields
obtain field If recursively is true obtain fields from all class hierarchy