private static void exportGetFieldCount(Collection<Field> fields, Writer out, int ind) throws IOException {
        out.write(ind(ind)+"@Override public int getFieldCount() {\n");
        out.write(ind(ind+1)+"int ret=0;\n");
        for (Field f : fields) {
            out.write(ind(ind+1)+"if ("+getter(f.getName())+"()!=null) ret++;\n");
        }
        out.write(ind(ind+1)+"return ret;\n");
        out.write(ind(ind)+"}\n\n");
    }
Override this, serialization of structs relies on it
vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java