private Book pack(Document d) {
        if (!Book.type.getName().equals(d.getDataType().getName())) return null;
        String dataType = d.getDataType().getName();
        Class generated;
        try {
            generated = Class.forName("com.yahoo.vespa.documentgen.test."+className(dataType));
        } catch (ClassNotFoundException e) {
            return null;
        }
        if (generated.getAnnotation(com.yahoo.document.Generated.class)==null) return null;
        Book book = new Book(d.getId());
        for (Iterator<Map.Entry<Field, FieldValue>> i = d.iterator(); i.hasNext() ; ) {
            Map.Entry<Field, FieldValue> e = i.next();
            Field f = e.getKey();
            FieldValue fv = e.getValue();
            book.setFieldValue(f, fv);
        }
        return book;
    }
Packs the given doc to Book
@param d doc, never null
@return a Book object or null if input doc isn't a Book
documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java