@@ -0,0 +1,1470 @@
+/**%0A * %0A */%0Apackage cn.strong.leke.data.mongo.convert;%0A%0Aimport org.springframework.core.convert.converter.GenericConverter.ConvertiblePair;%0Aimport org.springframework.util.Assert;%0A%0A/**%0A * %E5%8F%AF%E8%BD%AC%E6%8D%A2%E7%B1%BB%E5%9E%8B%E5%AF%B9%E6%B3%A8%E5%86%8C%0A * %0A * @author liulongbiao%0A *%0A */%0Apublic class ConverterRegistration %7B%0A%0A%09private final ConvertiblePair convertiblePair;%0A%09private final boolean reading;%0A%09private final boolean writing;%0A%0A%09public ConverterRegistration(ConvertiblePair convertiblePair, boolean isReading,%0A%09%09%09boolean isWriting) %7B%0A%09%09Assert.notNull(convertiblePair);%0A%09%09this.convertiblePair = convertiblePair;%0A%09%09this.reading = isReading;%0A%09%09this.writing = isWriting;%0A%09%7D%0A%0A%09public ConverterRegistration(Class%3C?%3E source, Class%3C?%3E target, boolean isReading,%0A%09%09%09boolean isWriting) %7B%0A%09%09this(new ConvertiblePair(source, target), isReading, isWriting);%0A%09%7D%0A%0A%09/**%0A%09 * %E6%98%AF%E5%90%A6%E5%8F%AF%E7%94%A8%E4%BA%8E%E5%86%99%E5%87%BA%0A%09 * %0A%09 * @return%0A%09 */%0A%09public boolean isWriting() %7B%0A%09%09return writing == true %7C%7C (!reading && isSimpleTargetType());%0A%09%7D%0A%0A%09/**%0A%09 * %E6%98%AF%E5%90%A6%E5%8F%AF%E7%94%A8%E4%BA%8E%E8%AF%BB%E5%8F%96%0A%09 * %0A%09 * @return%0A%09 */%0A%09public boolean isReading() %7B%0A%09%09return reading == true %7C%7C (!writing && isSimpleSourceType());%0A%09%7D%0A%0A%09public ConvertiblePair getConvertiblePair() %7B%0A%09%09return convertiblePair;%0A%09%7D%0A%0A%09/**%0A%09 * %E6%BA%90%E7%B1%BB%E5%9E%8B%E6%98%AF%E5%90%A6%E6%98%AF%E7%AE%80%E5%8D%95%E7%B1%BB%E5%9E%8B%0A%09 * %0A%09 * @return%0A%09 */%0A%09public boolean isSimpleSourceType() %7B%0A%09%09return BsonSimpleTypes.isSimpleType(convertiblePair.getSourceType());%0A%09%7D%0A%0A%09/**%0A%09 * %E7%9B%AE%E6%A0%87%E7%B1%BB%E5%9E%8B%E6%98%AF%E5%90%A6%E6%98%AF%E7%AE%80%E5%8D%95%E7%B1%BB%E5%9E%8B%0A%09 * %0A%09 * @return%0A%09 */%0A%09public boolean isSimpleTargetType() %7B%0A%09%09return BsonSimpleTypes.isSimpleType(convertiblePair.getTargetType());%0A%09%7D%0A%7D%0A

添加 ConverterRegistration