private static Set<DataType> exportStructTypes(Collection<DataType> fields, Writer out, int ind, Set<DataType> exportedStructs) throws IOException {
        if (exportedStructs==null) exportedStructs=new HashSet<>();
        for (DataType f : fields) {
            if ((f instanceof StructDataType) && ! f.getName().contains(".")) {
                if (exportedStructs.contains(f)) continue;
                exportedStructs.add(f);
                StructDataType structType = (StructDataType) f;
                String structClassName = className(structType.getName());
                out.write(ind(ind)+"/**\n" +
                ind(ind)+" *  Generated by vespa-documentgen-plugin, do not edit.\n" +
                ind(ind)+" *  Input struct type: "+structType.getName()+"\n" +
                ind(ind)+" *  Date: "+new Date()+"\n" +
                ind(ind)+" */\n" +
                ind(ind)+"@com.yahoo.document.Generated\n" +
                ind(ind) + "public static class "+structClassName+" extends com.yahoo.document.datatypes.Struct {\n\n" +
                ind(ind+1)+"/** The type of this.*/\n" +
                ind(ind+1)+"public static final com.yahoo.document.StructDataType type = getStructType();\n\n");
                out.write(ind(ind+1)+"public "+structClassName+"() {\n" +
                ind(ind+2)+"super("+structClassName+".type);\n" +
                ind(ind+1)+"}\n\n");
                exportCopyConstructor(structClassName, out, ind+1, false);
                exportExtendedStructTypeGetter(structClassName, structType.getName(), List.of(),
                        structType.getFields(), null, null, out, ind+1, "getStructType",
                        "com.yahoo.document.StructDataType");
                exportAssign(structType, structClassName, out, ind+1);
                exportFieldsAndAccessors(structClassName, structType.getFields(), out, ind+1, true);

                // Need these methods for serialization.
                // This can be improved by generating a method to serialize the struct _here_ (and one in the document), and use that in serialization.
                exportGetFields(structType.getFields(), out, ind+1);
                exportDocumentMethods(structType.getFields(), out, ind+1);
                exportHashCode(structType.getFields(), out, ind+1, "(getDataType() != null ? getDataType().hashCode() : 0)");
                exportEquals(structClassName, structType.getFields(), out, ind+1);
                out.write(ind(ind)+"}\n\n");
            }
        }
        return exportedStructs;
    }
Exports the struct types found in this collection of fields as separate Java classes
vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java