private FieldMappingInfo<T> readFieldMappingInfo(Field field, FieldMapping fma,
			DataTypeMapperContext context) {

		if (fma != null && !context.isFieldPresent(fma.presentWhen())) {
			// skip if this field was marked as not present
			return null;
		}

		String[] fieldNames = getFieldNamesToSearchFor(field, fma);
		DataTypeComponent dtc = getFirstMatchingField(fieldNames);
		if (useFieldMappingInfo && dtc == null) {
			if (fma.optional()) {
				return null;
			}
			throw new IllegalArgumentException(
				"Missing structure field: %s.%s for %s.%s".formatted(structureName,
					Arrays.toString(fieldNames), targetClass.getSimpleName(), field.getName()));
		}

		Signedness signedness = fma != null ? fma.signedness() : Signedness.Unspecified;
		int length = fma != null ? fma.length() : -1;
		FieldMappingInfo<T> fmi = useFieldMappingInfo
				? FieldMappingInfo.createEarlyBinding(field, dtc, signedness, length)
				: FieldMappingInfo.createLateBinding(field, fieldNames[0], signedness, length);

		@SuppressWarnings("rawtypes")
		Class<? extends FieldReadFunction> fieldReadFuncClass =
			fma != null ? fma.readFunc() : FieldReadFunction.class;
		String setterNameOverride = fma != null ? fma.setter() : null;
		fmi.setFieldValueDeserializationInfo(fieldReadFuncClass, targetClass, setterNameOverride);
		fmi.addMarkupNestedFuncs();
		fmi.addCommentMarkupFuncs();
		fmi.addMarkupReferenceFunc();

		return fmi;
	}
Initializes any {@link ContextField} fields in a new structure instance.

@param context {@link StructureContext}
@throws IOException if error assigning values to context fields in the structure mapped
instance
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/golang/structmapping/StructureMappingInfo.java