|
|
|
@ -166,7 +166,8 @@ public class MongoCustomConversions extends org.springframework.data.convert.Cus |
|
|
|
private boolean useNativeDriverJavaTimeCodecs = false; |
|
|
|
private boolean useNativeDriverJavaTimeCodecs = false; |
|
|
|
private final List<Object> customConverters = new ArrayList<>(); |
|
|
|
private final List<Object> customConverters = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
private PropertyValueConversions propertyValueConversions = new SimplePropertyValueConversions(); |
|
|
|
private PropertyValueConversions propertyValueConversions = PropertyValueConversions.simple(it -> {}); |
|
|
|
|
|
|
|
private PropertyValueConversions internallyCreatedValueConversion = propertyValueConversions; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create a {@link MongoConverterConfigurationAdapter} using the provided {@code converters} and our own codecs for |
|
|
|
* Create a {@link MongoConverterConfigurationAdapter} using the provided {@code converters} and our own codecs for |
|
|
|
@ -327,7 +328,7 @@ public class MongoCustomConversions extends org.springframework.data.convert.Cus |
|
|
|
PropertyValueConversions valueConversions() { |
|
|
|
PropertyValueConversions valueConversions() { |
|
|
|
|
|
|
|
|
|
|
|
if (this.propertyValueConversions == null) { |
|
|
|
if (this.propertyValueConversions == null) { |
|
|
|
this.propertyValueConversions = new SimplePropertyValueConversions(); |
|
|
|
this.propertyValueConversions = PropertyValueConversions.simple(it -> {}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return this.propertyValueConversions; |
|
|
|
return this.propertyValueConversions; |
|
|
|
@ -335,6 +336,10 @@ public class MongoCustomConversions extends org.springframework.data.convert.Cus |
|
|
|
|
|
|
|
|
|
|
|
ConverterConfiguration createConverterConfiguration() { |
|
|
|
ConverterConfiguration createConverterConfiguration() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isLocallyCreatedPropertyValueConversion() && propertyValueConversions instanceof SimplePropertyValueConversions svc) { |
|
|
|
|
|
|
|
svc.init(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!useNativeDriverJavaTimeCodecs) { |
|
|
|
if (!useNativeDriverJavaTimeCodecs) { |
|
|
|
return new ConverterConfiguration(STORE_CONVERSIONS, this.customConverters, convertiblePair -> true, |
|
|
|
return new ConverterConfiguration(STORE_CONVERSIONS, this.customConverters, convertiblePair -> true, |
|
|
|
this.propertyValueConversions); |
|
|
|
this.propertyValueConversions); |
|
|
|
@ -391,5 +396,9 @@ public class MongoCustomConversions extends org.springframework.data.convert.Cus |
|
|
|
return DateToUtcLocalDateTimeConverter.INSTANCE.convert(source).toLocalDate(); |
|
|
|
return DateToUtcLocalDateTimeConverter.INSTANCE.convert(source).toLocalDate(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isLocallyCreatedPropertyValueConversion() { |
|
|
|
|
|
|
|
return propertyValueConversions == internallyCreatedValueConversion; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|