private void updateClassMap(FieldMetaData metaData, Class<?> clazz) {
        final String fieldName = metaData.fieldName;

        final FieldValueMetaData elementMetaData;
        if (metaData.valueMetaData.isContainer()) {
            if (metaData.valueMetaData instanceof SetMetaData) {
                elementMetaData = ((SetMetaData) metaData.valueMetaData).elemMetaData;
            } else if (metaData.valueMetaData instanceof ListMetaData) {
                elementMetaData = ((ListMetaData) metaData.valueMetaData).elemMetaData;
            } else if (metaData.valueMetaData instanceof MapMetaData) {
                final MapMetaData mapMetaData = (MapMetaData) metaData.valueMetaData;
                final byte req = TFieldRequirementType.REQUIRED;

                final FieldMetaData keyMetaData = new FieldMetaData(
                        fieldName + TTextProtocol.MAP_KEY_SUFFIX, req, mapMetaData.keyMetaData);
                updateClassMap(keyMetaData, clazz);

                final FieldMetaData valueMetaData = new FieldMetaData(
                        fieldName + TTextProtocol.MAP_VALUE_SUFFIX, req, mapMetaData.valueMetaData);
                updateClassMap(valueMetaData, clazz);

                return;
            } else {
                // Unrecognized container type, but let's still continue processing without
                // special enum support.
                elementMetaData = metaData.valueMetaData;
            }
        } else {
            elementMetaData = metaData.valueMetaData;
        }

        if (elementMetaData instanceof EnumMetaData) {
            classMap.put(fieldName, ((EnumMetaData) elementMetaData).enumClass);
        } else if (elementMetaData instanceof StructMetaData) {
            classMap.put(fieldName, ((StructMetaData) elementMetaData).structClass);
        } else {
            // Workaround a bug where the generated 'FieldMetaData' does not provide
            // a fully qualified class name.
            final String typedefName = elementMetaData.getTypedefName();
            if (typedefName != null) {
                final String fqcn = clazz.getPackage().getName() + '.' + typedefName;
                Class<?> fieldClass = fieldMetaDataClassCache.get(fqcn);
                if (fieldClass == null) {
                    fieldClass = fieldMetaDataClassCache.computeIfAbsent(fqcn, key -> {
                        try {
                            return Class.forName(key);
                        } catch (ClassNotFoundException ignored) {
                            return StructContext.class;
                        }
                    });
                }
                if (fieldClass != StructContext.class) {
                    classMap.put(fieldName, fieldClass);
                }
            }
        }
    }
Compute a new field name map for the current thrift message
we are parsing.
thrift/thrift0.13/src/main/java/com/linecorp/armeria/common/thrift/text/StructContext.java