@SuppressWarnings("unchecked")
	// we know the type is safe, since we search by class type
	public static <T> T getInstanceFieldByClassType(Class<T> classType, Object ownerInstance) {
		if (ownerInstance == null) {
			throw new NullPointerException("Owner of instance field cannot be null");
		}

		Class<?> objectClass =
			(ownerInstance instanceof Class) ? (Class<?>) ownerInstance : ownerInstance.getClass();

		Object result = null;
		try {
			// get the field from the class object 
			Field field = locateFieldByTypeOnClass(classType, objectClass);
			if (field == null) {
				return null;
			}

			// open up the field so that we have access
			field.setAccessible(true);

			// get the field from the object instance that we were provided
			result = field.get(ownerInstance);
		}
		catch (Exception e) {
			throw new RuntimeException("Unable to use reflection to obtain " + "a field of type: " +
				classType.getName() + " from class: " + objectClass, e);
		}

		return (T) result;
	}
Get the first field object contained within object ownerInstance which has the type classType.
This method is only really useful if it is known that only a single field of 
classType exists within the ownerInstance.

@param <T> the type
@param classType the class type of the desired field
@param ownerInstance the object instance that owns the field
@return field object of type classType or null
Ghidra/Framework/Generic/src/main/java/generic/test/TestUtils.java