/**
 * 
 */
package cn.strong.leke.data.mongo;

import org.bson.Document;

import cn.strong.leke.data.mongo.convert.DefaultBsonConverter;

/**
 * BSON 转换工具类
 * 
 * @author liulongbiao
 *
 */
public class BsonUtils {

	private static final DefaultBsonConverter CONVERTER = new DefaultBsonConverter();

	/**
	 * 将 JavaBean 转换为 Mongo 文档
	 * 
	 * @param bean
	 * @return
	 */
	public static Document toBSON(Object bean) {
		return (Document) CONVERTER.toBSON(bean);
	}

	/**
	 * 将 Mongo 文档转换为 JavaBean
	 * 
	 * @param doc
	 * @return
	 */
	public static <R> R fromBSON(Document doc, Class<R> clazz) {
		return CONVERTER.fromBSON(doc, clazz);
	}
}

@@ -459,16 +459,179 @@
 n);%0A%09%7D%0A%0A
+%09/**%0A%09 * %E5%B0%86%E4%BB%BB%E6%84%8F%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2%E6%88%90 Document %E6%89%80%E6%94%AF%E6%8C%81%E7%9A%84 Bson %E7%B1%BB%E5%9E%8B%E7%9A%84%E5%80%BC%0A%09 * %0A%09 * @param obj%0A%09 * @return%0A%09 */%0A%09public static Object toBsonValue(Object obj) %7B%0A%09%09return CONVERTER.toBSON(obj);%0A%09%7D%0A%0A
 %09/**%0A%09 *

add toBsonValue