Skip to content

Commit 9c64dd9

Browse files
authored
DATAES-743 - Revert geo converters to back to store converters.
Original PR: spring-projects#390
1 parent b2ffc23 commit 9c64dd9

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

src/main/java/org/springframework/data/elasticsearch/config/ElasticsearchConfigurationSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public SimpleElasticsearchMappingContext elasticsearchMappingContext() {
7676
*/
7777
@Bean
7878
public ElasticsearchCustomConversions elasticsearchCustomConversions() {
79-
return ElasticsearchCustomConversions.of(Collections.emptyList());
79+
return new ElasticsearchCustomConversions(Collections.emptyList());
8080
}
8181

8282
/**

src/main/java/org/springframework/data/elasticsearch/core/convert/ElasticsearchCustomConversions.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class ElasticsearchCustomConversions extends CustomConversions {
4343

4444
static {
4545

46-
List<Converter<?, ?>> converters = new ArrayList<>();
46+
List<Converter<?, ?>> converters = new ArrayList<>(GeoConverters.getConvertersToRegister());
4747
converters.add(StringToUUIDConverter.INSTANCE);
4848
converters.add(UUIDToStringConverter.INSTANCE);
4949
converters.add(BigDecimalToDoubleConverter.INSTANCE);
@@ -58,14 +58,8 @@ public class ElasticsearchCustomConversions extends CustomConversions {
5858
*
5959
* @param converters must not be {@literal null}.
6060
*/
61-
public static ElasticsearchCustomConversions of(Collection<Converter<?, ?>> converters) {
62-
List<Converter<?, ?>> userConverters = new ArrayList<>(GeoConverters.getConvertersToRegister());
63-
userConverters.addAll(converters);
64-
return new ElasticsearchCustomConversions(STORE_CONVERSIONS, userConverters);
65-
}
66-
67-
private ElasticsearchCustomConversions(StoreConversions storeConversions, Collection<?> converters) {
68-
super(storeConversions, converters);
61+
public ElasticsearchCustomConversions(Collection<?> converters) {
62+
super(STORE_CONVERSIONS, converters);
6963
}
7064

7165
/**

src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public class MappingElasticsearchConverter
8585
private final MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext;
8686
private final GenericConversionService conversionService;
8787

88-
private CustomConversions conversions = ElasticsearchCustomConversions.of(Collections.emptyList());
88+
private CustomConversions conversions = new ElasticsearchCustomConversions(Collections.emptyList());
8989
private EntityInstantiators instantiators = new EntityInstantiators();
9090

9191
private ElasticsearchTypeMapper typeMapper;

src/test/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverterUnitTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public void init() {
108108

109109
mappingElasticsearchConverter = new MappingElasticsearchConverter(mappingContext, new GenericConversionService());
110110
mappingElasticsearchConverter.setConversions(
111-
ElasticsearchCustomConversions.of(Arrays.asList(new ShotGunToMapConverter(), new MapToShotGunConverter())));
111+
new ElasticsearchCustomConversions(Arrays.asList(new ShotGunToMapConverter(), new MapToShotGunConverter())));
112112
mappingElasticsearchConverter.afterPropertiesSet();
113113

114114
sarahConnor = new Person();

0 commit comments

Comments
 (0)