private static void exportFieldsAndAccessors(String className, Collection<Field> fields, Writer out, int ind, boolean spanTrees) throws IOException {
        // List the fields as Java fields
        for (Field field: fields) {
            DataType dt = field.getDataType();
            out.write(
            ind(ind)+toJavaType(dt)+" "+field.getName()+";\n");
            if (spanTrees && dt.equals(DataType.STRING)) {
                out.write(ind(ind)+"java.util.Map<java.lang.String,com.yahoo.document.annotation.SpanTree> "+spanTreeGetter(field.getName())+";\n"); // same name on field as get method
            }
        }
        out.write(ind(ind)+"\n");
        // Getters, setters and annotation spantree lists for string fields
        for (Field field: fields) {
            DataType dt = field.getDataType();
            out.write(
                    ind(ind) + "public " + toJavaType(dt) + " " + getter(field.getName()) + "() { return " + field.getName() + "; }\n" +
                    ind(ind) + "public " + className + " " + setter(field.getName()) + "(" + toJavaType(dt) + " " + field.getName() + ") {\n" +
                    validateArgument(field.getDataType(), field.getName(), ind + 1) +
                    ind(ind+1) + "this." + field.getName() + "=" + field.getName() + ";\n" +
                    ind(ind+1) + "return this;\n" +
                    ind(ind) + "}\n");
            if (spanTrees && dt.equals(DataType.STRING)) {
                out.write(ind(ind)+"public java.util.Map<java.lang.String,com.yahoo.document.annotation.SpanTree> "+spanTreeGetter(field.getName())+"() { return "+field.getName()+"SpanTrees; }\n" +
                        ind(ind)+"public void "+spanTreeSetter(field.getName())+"(java.util.Map<java.lang.String,com.yahoo.document.annotation.SpanTree> spanTrees) { this."+field.getName()+"SpanTrees=spanTrees; }\n");
            }
        }
        out.write("\n");
    }
Exports this set of fields with getters and setters
@param spanTrees If true, include a reference to the list of span trees for the string fields
vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java