public static Field findField(String className, String fieldName) throws ClassNotFoundException {
        JavaClass jclass = Repository.lookupClass(className);

        while (jclass != null) {
            Field[] fieldList = jclass.getFields();
            for (Field field : fieldList) {
                if (field.getName().equals(fieldName)) {
                    return field;
                }
            }

            jclass = jclass.getSuperClass();
        }

        return null;
    }
public static Field findField ( String className , String fieldName ) throws ClassNotFoundException { JavaClass jclass = Repository . lookupClass ( className ) ; while ( jclass != null ) { Field [ ] fieldList = jclass . getFields ( ) ; for ( Field field : fieldList ) { if ( field . getName ( ) . equals ( fieldName ) ) { return field ; } } jclass = jclass . getSuperClass ( ) ; } return null ; }
Find a field with given name defined in given class.

@param className
the name of the class
@param fieldName
the name of the field
@return the Field, or null if no such field could be found