Skip to content

Commit 45e70d4

Browse files
christophstroblThomas Darimont
authored andcommitted
DATAMONGO-1016 - Remove deprecations in geospatial area.
Removed: - Box - Circle - CustomMetric - Distance - GeoPage - GeoResult - GeoResults - Metric - Metrics - Point - Polygon - Shape Updated api doc. Removed deprecation warnings.
1 parent ce71ab8 commit 45e70d4

30 files changed

+38
-1298
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoOperations.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
import java.util.List;
2020
import java.util.Set;
2121

22+
import org.springframework.data.geo.GeoResults;
2223
import org.springframework.data.mongodb.core.aggregation.Aggregation;
2324
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
2425
import org.springframework.data.mongodb.core.aggregation.TypedAggregation;
2526
import org.springframework.data.mongodb.core.convert.MongoConverter;
26-
import org.springframework.data.mongodb.core.geo.GeoResults;
2727
import org.springframework.data.mongodb.core.mapreduce.GroupBy;
2828
import org.springframework.data.mongodb.core.mapreduce.GroupByResults;
2929
import org.springframework.data.mongodb.core.mapreduce.MapReduceOptions;
@@ -52,7 +52,6 @@
5252
* @author Christoph Strobl
5353
* @author Thomas Darimont
5454
*/
55-
@SuppressWarnings("deprecation")
5655
public interface MongoOperations {
5756

5857
/**

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.springframework.data.convert.EntityReader;
5454
import org.springframework.data.geo.Distance;
5555
import org.springframework.data.geo.GeoResult;
56+
import org.springframework.data.geo.GeoResults;
5657
import org.springframework.data.geo.Metric;
5758
import org.springframework.data.mapping.context.MappingContext;
5859
import org.springframework.data.mapping.model.BeanWrapper;
@@ -71,7 +72,6 @@
7172
import org.springframework.data.mongodb.core.convert.MongoWriter;
7273
import org.springframework.data.mongodb.core.convert.QueryMapper;
7374
import org.springframework.data.mongodb.core.convert.UpdateMapper;
74-
import org.springframework.data.mongodb.core.geo.GeoResults;
7575
import org.springframework.data.mongodb.core.index.MongoMappingEventPublisher;
7676
import org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator;
7777
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/GeoConverters.java

Lines changed: 10 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,15 @@ private GeoConverters() {}
5757
*
5858
* @return
5959
*/
60-
@SuppressWarnings("unchecked")
6160
public static Collection<? extends Object> getConvertersToRegister() {
6261
return Arrays.asList( //
6362
BoxToDbObjectConverter.INSTANCE //
6463
, PolygonToDbObjectConverter.INSTANCE //
6564
, CircleToDbObjectConverter.INSTANCE //
66-
, LegacyCircleToDbObjectConverter.INSTANCE //
6765
, SphereToDbObjectConverter.INSTANCE //
6866
, DbObjectToBoxConverter.INSTANCE //
6967
, DbObjectToPolygonConverter.INSTANCE //
7068
, DbObjectToCircleConverter.INSTANCE //
71-
, DbObjectToLegacyCircleConverter.INSTANCE //
7269
, DbObjectToSphereConverter.INSTANCE //
7370
, DbObjectToPointConverter.INSTANCE //
7471
, PointToDbObjectConverter.INSTANCE //
@@ -91,13 +88,11 @@ public static enum DbObjectToPointConverter implements Converter<DBObject, Point
9188
* @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object)
9289
*/
9390
@Override
94-
@SuppressWarnings("deprecation")
9591
public Point convert(DBObject source) {
9692

9793
Assert.isTrue(source.keySet().size() == 2, "Source must contain 2 elements");
9894

99-
return source == null ? null : new org.springframework.data.mongodb.core.geo.Point((Double) source.get("x"),
100-
(Double) source.get("y"));
95+
return source == null ? null : new Point((Double) source.get("x"), (Double) source.get("y"));
10196
}
10297
}
10398

@@ -151,7 +146,7 @@ public DBObject convert(Box source) {
151146
}
152147

153148
/**
154-
* Converts a {@link BasicDBList} into a {@link org.springframework.data.mongodb.core.geo.Box}.
149+
* Converts a {@link BasicDBList} into a {@link Box}.
155150
*
156151
* @author Thomas Darimont
157152
* @since 1.5
@@ -166,7 +161,6 @@ public static enum DbObjectToBoxConverter implements Converter<DBObject, Box> {
166161
* @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object)
167162
*/
168163
@Override
169-
@SuppressWarnings("deprecation")
170164
public Box convert(DBObject source) {
171165

172166
if (source == null) {
@@ -176,7 +170,7 @@ public Box convert(DBObject source) {
176170
Point first = DbObjectToPointConverter.INSTANCE.convert((DBObject) source.get("first"));
177171
Point second = DbObjectToPointConverter.INSTANCE.convert((DBObject) source.get("second"));
178172

179-
return new org.springframework.data.mongodb.core.geo.Box(first, second);
173+
return new Box(first, second);
180174
}
181175
}
182176

@@ -210,7 +204,7 @@ public DBObject convert(Circle source) {
210204
}
211205

212206
/**
213-
* Converts a {@link DBObject} into a {@link org.springframework.data.mongodb.core.geo.Circle}.
207+
* Converts a {@link DBObject} into a {@link Circle}.
214208
*
215209
* @author Thomas Darimont
216210
* @since 1.5
@@ -251,71 +245,6 @@ public Circle convert(DBObject source) {
251245
}
252246
}
253247

254-
/**
255-
* Converts a {@link Circle} into a {@link BasicDBList}.
256-
*
257-
* @author Thomas Darimont
258-
* @since 1.5
259-
*/
260-
@SuppressWarnings("deprecation")
261-
public static enum LegacyCircleToDbObjectConverter implements
262-
Converter<org.springframework.data.mongodb.core.geo.Circle, DBObject> {
263-
264-
INSTANCE;
265-
266-
/*
267-
* (non-Javadoc)
268-
* @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object)
269-
*/
270-
@Override
271-
public DBObject convert(org.springframework.data.mongodb.core.geo.Circle source) {
272-
273-
if (source == null) {
274-
return null;
275-
}
276-
277-
DBObject result = new BasicDBObject();
278-
result.put("center", PointToDbObjectConverter.INSTANCE.convert(source.getCenter()));
279-
result.put("radius", source.getRadius());
280-
return result;
281-
}
282-
}
283-
284-
/**
285-
* Converts a {@link BasicDBList} into a {@link org.springframework.data.mongodb.core.geo.Circle}.
286-
*
287-
* @author Thomas Darimont
288-
* @since 1.5
289-
*/
290-
@ReadingConverter
291-
@SuppressWarnings("deprecation")
292-
public static enum DbObjectToLegacyCircleConverter implements
293-
Converter<DBObject, org.springframework.data.mongodb.core.geo.Circle> {
294-
295-
INSTANCE;
296-
297-
/*
298-
* (non-Javadoc)
299-
* @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object)
300-
*/
301-
@Override
302-
public org.springframework.data.mongodb.core.geo.Circle convert(DBObject source) {
303-
304-
if (source == null) {
305-
return null;
306-
}
307-
308-
DBObject centerSource = (DBObject) source.get("center");
309-
Double radius = (Double) source.get("radius");
310-
311-
Assert.notNull(centerSource, "Center must not be null!");
312-
Assert.notNull(radius, "Radius must not be null!");
313-
314-
Point center = DbObjectToPointConverter.INSTANCE.convert(centerSource);
315-
return new org.springframework.data.mongodb.core.geo.Circle(center, radius);
316-
}
317-
}
318-
319248
/**
320249
* Converts a {@link Sphere} into a {@link BasicDBList}.
321250
*
@@ -422,7 +351,7 @@ public DBObject convert(Polygon source) {
422351
}
423352

424353
/**
425-
* Converts a {@link BasicDBList} into a {@link org.springframework.data.mongodb.core.geo.Polygon}.
354+
* Converts a {@link BasicDBList} into a {@link Polygon}.
426355
*
427356
* @author Thomas Darimont
428357
* @since 1.5
@@ -437,7 +366,7 @@ public static enum DbObjectToPolygonConverter implements Converter<DBObject, Pol
437366
* @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object)
438367
*/
439368
@Override
440-
@SuppressWarnings({ "deprecation", "unchecked" })
369+
@SuppressWarnings({ "unchecked" })
441370
public Polygon convert(DBObject source) {
442371

443372
if (source == null) {
@@ -453,7 +382,7 @@ public Polygon convert(DBObject source) {
453382
newPoints.add(DbObjectToPointConverter.INSTANCE.convert(element));
454383
}
455384

456-
return new org.springframework.data.mongodb.core.geo.Polygon(newPoints);
385+
return new Polygon(newPoints);
457386
}
458387
}
459388

@@ -472,7 +401,6 @@ public static enum GeoCommandToDbObjectConverter implements Converter<GeoCommand
472401
* @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object)
473402
*/
474403
@Override
475-
@SuppressWarnings("deprecation")
476404
public DBObject convert(GeoCommand source) {
477405

478406
if (source == null) {
@@ -493,10 +421,10 @@ public DBObject convert(GeoCommand source) {
493421
argument.add(toList(((Circle) shape).getCenter()));
494422
argument.add(((Circle) shape).getRadius().getNormalizedValue());
495423

496-
} else if (shape instanceof org.springframework.data.mongodb.core.geo.Circle) {
424+
} else if (shape instanceof Circle) {
497425

498-
argument.add(toList(((org.springframework.data.mongodb.core.geo.Circle) shape).getCenter()));
499-
argument.add(((org.springframework.data.mongodb.core.geo.Circle) shape).getRadius());
426+
argument.add(toList(((Circle) shape).getCenter()));
427+
argument.add(((Circle) shape).getRadius());
500428

501429
} else if (shape instanceof Polygon) {
502430

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/Box.java

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)