@@ -0,0 +1,1012 @@
+/**%0A * %0A */%0Apackage cn.strong.leke.data.mongo.codec;%0A%0Aimport java.util.concurrent.ConcurrentHashMap;%0Aimport java.util.concurrent.ConcurrentMap;%0A%0Aimport org.bson.codecs.Codec;%0Aimport org.bson.codecs.configuration.CodecProvider;%0Aimport org.bson.codecs.configuration.CodecRegistry;%0A%0Aimport cn.strong.leke.data.mongo.convert.BeanMeta;%0A%0A/**%0A * JavaBean %E7%BC%96%E7%A0%81%E5%99%A8%E6%8F%90%E4%BE%9B%E8%80%85%0A * %0A * @author liulongbiao%0A *%0A */%0Apublic class BeanCodecProvider implements CodecProvider %7B%0A%0A%09@SuppressWarnings(%22rawtypes%22)%0A%09private ConcurrentMap%3CClass, BeanCodec%3E codecs = new ConcurrentHashMap%3C%3E();%0A%0A%09@SuppressWarnings(%22unchecked%22)%0A%09@Override%0A%09public %3CT%3E Codec%3CT%3E get(Class%3CT%3E clazz, CodecRegistry registry) %7B%0A%09%09if (codecs.containsKey(clazz)) %7B%0A%09%09%09return codecs.get(clazz);%0A%09%09%7D%0A%09%09if (isBeanClass(clazz)) %7B%0A%09%09%09BeanCodec%3CT%3E codec = new BeanCodec%3C%3E(registry, clazz);%0A%09%09%09codecs.put(clazz, codec);%0A%09%09%09return codec;%0A%09%09%7D%0A%0A%09%09return null;%0A%09%7D%0A%0A%09private %3CT%3E boolean isBeanClass(Class%3CT%3E clazz) %7B%0A%09%09BeanMeta bm = BeanMeta.from(clazz);%0A%09%09return bm.isBeanClass();%0A%09%7D%0A%7D%0A

添加 BeanCodecProvider