core/src/main/java/org/springframework/security/util/FieldUtils.java
public static Field getField(Class<?> clazz, String fieldName)
			throws IllegalStateException {
		Assert.notNull(clazz, "Class required");
		Assert.hasText(fieldName, "Field name required");

		try {
			return clazz.getDeclaredField(fieldName);
		}
		catch (NoSuchFieldException nsf) {
			// Try superclass
			if (clazz.getSuperclass() != null) {
				return getField(clazz.getSuperclass(), fieldName);
			}

			throw new IllegalStateException("Could not locate field '" + fieldName
					+ "' on class " + clazz);
		}
	}
public static Field getField(Class<?> clazz, String fieldName)
			throws IllegalStateException {
		Assert.notNull(clazz, "Class required");
		Assert.hasText(fieldName, "Field name required");

		try {
			return clazz.getDeclaredField(fieldName);
		}
		catch (NoSuchFieldException nsf) {
			// Try superclass
			if (clazz.getSuperclass() != null) {
				return getField(clazz.getSuperclass(), fieldName);
			}

			throw new IllegalStateException("Could not locate field '" + fieldName
					+ "' on class " + clazz);
		}
	}
public static Field getField ( Class < ? > clazz , String fieldName ) throws IllegalStateException { Assert . notNull ( clazz , "Class required" ) ; Assert . hasText ( fieldName , "Field name required" ) ; try { return clazz . getDeclaredField ( fieldName ) ; } catch ( NoSuchFieldException nsf ) { // Try superclass if ( clazz . getSuperclass ( ) != null ) { return getField ( clazz . getSuperclass ( ) , fieldName ) ; } throw new IllegalStateException ( "Could not locate field '" + fieldName + "' on class " + clazz ) ; } }
Attempts to locate the specified field on the class.

@param clazz the class definition containing the field
@param fieldName the name of the field to locate

@return the Field (never null)

@throws IllegalStateException if field could not be found
Attempts to locate the specified field on the class .