private static void exportExtendedStructTypeGetter(String className, String name, Collection<NewDocumentType> parentTypes,
                                                       Collection<Field> fields, Set<FieldSet> fieldSets,
                                                       Set<String> importedFieldNames, Writer out, int ind,
                                                       String methodName, String retType) throws IOException {
        out.write(ind(ind)+"private static "+retType+" "+methodName+"() {\n");
        String bodyIndent = ind(ind + 1);
        if (importedFieldNames != null) {
            exportImportedFields(importedFieldNames, out, ind + 1);
            out.write(bodyIndent+retType+" ret = new "+retType+"(\"" + name + "\", importedFieldNames);\n");
        } else {
            out.write(bodyIndent+retType+" ret = new "+retType+"(\""+name+"\");\n");
        }
        for (Field f : fields) {
            if (f.getDataType().equals(DataType.STRING)) {
                addExtendedStringField(className, f, out, ind + 1);
            } else {
                addExtendedField(className, f, out, ind + 1);
            }
        }
        if (fieldSets != null) {
            exportFieldSetDefinition(fieldSets, out, ind+1);
        }
        for (NewDocumentType parentType : parentTypes) {
            if (!parentType.getName().equals("document")) {
                out.write("%sret.inherit(%s.type);\n".formatted(bodyIndent, className(parentType.getName())));
            }
        }

        out.write(bodyIndent+"return ret;\n");
        out.write(ind(ind)+"}\n\n");
    }
\n"+
                ind(ind)+" * Constructs a "+className+" by taking a deep copy of the provided StructuredFieldValue.\n" +
                ind(ind)+"
vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java