public static <R> R getFieldValue(Object obj, Field field, Class<R> expectedType)
			throws IOException {
		try {
			Object val = field.get(obj);
			if (val != null && !expectedType.isInstance(val)) {
				throw new IOException(
					"Unexpected field value type: " + val.getClass() + " in " + field);
			}
			return expectedType.cast(val);
		}
		catch (IllegalArgumentException | IllegalAccessException e) {
			throw new IOException(e);
		}
	}
Returns a list of methods that have been marked with a specific annotation.

@param targetClass class to query
@param annotationClass annotation to search for
@param methods list to accumulate results into, or null to allocate new list.  Also returned
as the result of this function
@param includeParentClasses boolean flag, if true recurse into parent classes first
@param paramClasses list of parameters that the tagged methods should declare.  Methods
will be skipped if they don't match
@return list of found methods that match the annotation and param list
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/golang/structmapping/ReflectionHelper.java