@@ -0,0 +1,643 @@
+/**%0A * %0A */%0Apackage cn.strong.leke.data.mongo;%0A%0Aimport org.bson.Document;%0A%0Aimport cn.strong.leke.data.mongo.convert.DefaultBsonConverter;%0A%0A/**%0A * BSON %E8%BD%AC%E6%8D%A2%E5%B7%A5%E5%85%B7%E7%B1%BB%0A * %0A * @author liulongbiao%0A *%0A */%0Apublic class BsonUtils %7B%0A%0A%09private static final DefaultBsonConverter CONVERTER = new DefaultBsonConverter();%0A%0A%09/**%0A%09 * %E5%B0%86 JavaBean %E8%BD%AC%E6%8D%A2%E4%B8%BA Mongo %E6%96%87%E6%A1%A3%0A%09 * %0A%09 * @param bean%0A%09 * @return%0A%09 */%0A%09public static Document toBSON(Object bean) %7B%0A%09%09return (Document) CONVERTER.toBSON(bean);%0A%09%7D%0A%0A%09/**%0A%09 * %E5%B0%86 Mongo %E6%96%87%E6%A1%A3%E8%BD%AC%E6%8D%A2%E4%B8%BA JavaBean%0A%09 * %0A%09 * @param doc%0A%09 * @return%0A%09 */%0A%09public static %3CR%3E R fromBSON(Document doc, Class%3CR%3E clazz) %7B%0A%09%09return CONVERTER.fromBSON(doc, clazz);%0A%09%7D%0A%7D%0A

添加 BsonUtils 工具类