private static void exportIterator(Collection<Field> fieldSet, Writer out, int ind) throws IOException {
        out.write(ind(ind)+"@Override public java.util.Iterator<java.util.Map.Entry<com.yahoo.document.Field, com.yahoo.document.datatypes.FieldValue>> iterator() {\n");
        out.write(ind(ind+1)+"java.util.Map<com.yahoo.document.Field, com.yahoo.document.datatypes.FieldValue> ret = new java.util.HashMap<>();\n");
        for (Field field: fieldSet) {
            String name = field.getName();
            out.write(ind(ind+1)+"if ("+getter(name)+"()!=null) {\n");
            out.write(ind(ind+2)+"com.yahoo.document.Field f = getField(\""+name+"\");\n");
            out.write(ind(ind+2)+"ret.put(f, ((com.yahoo.document.ExtendedField)f).getFieldValue(this));\n" + ind(ind+1)+"}\n");
        }
        out.write(ind(ind+1)+"return ret.entrySet().iterator();\n" +
                ind(ind)+"}\n\n");
    }
Exports the necessary overridden methods from Document/StructuredFieldValue
vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java