|
15 | 15 | */
|
16 | 16 | package org.springframework.data.mongodb.core.convert;
|
17 | 17 |
|
18 |
| -import static org.springframework.data.convert.ConverterBuilder.*; |
19 |
| - |
20 | 18 | import java.math.BigInteger;
|
21 | 19 | import java.util.Date;
|
22 | 20 |
|
|
26 | 24 | import org.springframework.core.convert.ConversionService;
|
27 | 25 | import org.springframework.core.convert.support.DefaultConversionService;
|
28 | 26 | import org.springframework.core.convert.support.GenericConversionService;
|
| 27 | +import org.springframework.data.convert.ConverterBuilder; |
29 | 28 | import org.springframework.data.convert.CustomConversions;
|
30 | 29 | import org.springframework.data.convert.EntityInstantiators;
|
31 | 30 | import org.springframework.data.mongodb.core.convert.MongoConverters.BigIntegerToObjectIdConverter;
|
@@ -98,20 +97,23 @@ private void initializeConverters() {
|
98 | 97 | }
|
99 | 98 |
|
100 | 99 | if (!conversionService.canConvert(Date.class, Long.class)) {
|
101 |
| - conversionService.addConverter(writing(Date.class, Long.class, Date::getTime).getWritingConverter()); |
| 100 | + conversionService |
| 101 | + .addConverter(ConverterBuilder.writing(Date.class, Long.class, Date::getTime).getWritingConverter()); |
102 | 102 | }
|
103 | 103 |
|
104 | 104 | if (!conversionService.canConvert(Long.class, Date.class)) {
|
105 |
| - conversionService.addConverter(reading(Long.class, Date.class, Date::new).getReadingConverter()); |
| 105 | + conversionService.addConverter(ConverterBuilder.reading(Long.class, Date.class, Date::new).getReadingConverter()); |
106 | 106 | }
|
107 | 107 |
|
108 | 108 | if (!conversionService.canConvert(ObjectId.class, Date.class)) {
|
109 | 109 |
|
110 | 110 | conversionService.addConverter(
|
111 |
| - reading(ObjectId.class, Date.class, objectId -> new Date(objectId.getTimestamp())).getReadingConverter()); |
| 111 | + ConverterBuilder.reading(ObjectId.class, Date.class, objectId -> new Date(objectId.getTimestamp())) |
| 112 | + .getReadingConverter()); |
112 | 113 | }
|
113 | 114 |
|
114 |
| - conversionService.addConverter(reading(Code.class, String.class, Code::getCode).getReadingConverter()); |
| 115 | + conversionService |
| 116 | + .addConverter(ConverterBuilder.reading(Code.class, String.class, Code::getCode).getReadingConverter()); |
115 | 117 | conversions.registerConvertersIn(conversionService);
|
116 | 118 | }
|
117 | 119 |
|
|
0 commit comments