private void outputFuncWithGetter(Method getter, StructureContext<T> context,
			Structure structure) throws IOException {
		Object getterResult =
			ReflectionHelper.callGetter(getter, context.getStructureInstance(), Object.class);
		if (getterResult == null) {
			//do nothing
		}
		else if (getterResult instanceof DataType dt) {
			preAddField(structure);
			structure.add(dt, fmi.getFieldName(), null);
		}
		else if (getterResult instanceof DataTypeInstance dti) {
			preAddField(structure);
			structure.add(dti.getDataType(), dti.getLength(), fmi.getFieldName(), null);
		}
		else {
			throw new IOException("Bad result type for FieldOutput.getter: %s"
					.formatted(getterResult.getClass().getSimpleName()));
		}
	}
Returns the value of this java field.

@param <R> type of the result value
@param structInstance object containing the field
@param expectedType expected class of the value 
@return value of the field, or null if the field's value is not of expected type
@throws IOException if error accessing java field
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/golang/structmapping/FieldOutputInfo.java