private static Field getDeclaredFieldSuper ( Class < ? > clazz , String name ) throws NoSuchFieldException { try { return clazz . getDeclaredField ( name ) ; } catch ( final NoSuchFieldException exception ) { if ( clazz . getSuperclass ( ) == null ) { throw exception ; } return getDeclaredFieldSuper ( clazz . getSuperclass ( ) , name ) ; } }
Get the field by reflection searching in super class if needed .