@@ -57,18 +57,15 @@ private GeoConverters() {}
57
57
*
58
58
* @return
59
59
*/
60
- @ SuppressWarnings ("unchecked" )
61
60
public static Collection <? extends Object > getConvertersToRegister () {
62
61
return Arrays .asList ( //
63
62
BoxToDbObjectConverter .INSTANCE //
64
63
, PolygonToDbObjectConverter .INSTANCE //
65
64
, CircleToDbObjectConverter .INSTANCE //
66
- , LegacyCircleToDbObjectConverter .INSTANCE //
67
65
, SphereToDbObjectConverter .INSTANCE //
68
66
, DbObjectToBoxConverter .INSTANCE //
69
67
, DbObjectToPolygonConverter .INSTANCE //
70
68
, DbObjectToCircleConverter .INSTANCE //
71
- , DbObjectToLegacyCircleConverter .INSTANCE //
72
69
, DbObjectToSphereConverter .INSTANCE //
73
70
, DbObjectToPointConverter .INSTANCE //
74
71
, PointToDbObjectConverter .INSTANCE //
@@ -91,13 +88,11 @@ public static enum DbObjectToPointConverter implements Converter<DBObject, Point
91
88
* @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object)
92
89
*/
93
90
@ Override
94
- @ SuppressWarnings ("deprecation" )
95
91
public Point convert (DBObject source ) {
96
92
97
93
Assert .isTrue (source .keySet ().size () == 2 , "Source must contain 2 elements" );
98
94
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" ));
101
96
}
102
97
}
103
98
@@ -151,7 +146,7 @@ public DBObject convert(Box source) {
151
146
}
152
147
153
148
/**
154
- * Converts a {@link BasicDBList} into a {@link org.springframework.data.mongodb.core.geo. Box}.
149
+ * Converts a {@link BasicDBList} into a {@link Box}.
155
150
*
156
151
* @author Thomas Darimont
157
152
* @since 1.5
@@ -166,7 +161,6 @@ public static enum DbObjectToBoxConverter implements Converter<DBObject, Box> {
166
161
* @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object)
167
162
*/
168
163
@ Override
169
- @ SuppressWarnings ("deprecation" )
170
164
public Box convert (DBObject source ) {
171
165
172
166
if (source == null ) {
@@ -176,7 +170,7 @@ public Box convert(DBObject source) {
176
170
Point first = DbObjectToPointConverter .INSTANCE .convert ((DBObject ) source .get ("first" ));
177
171
Point second = DbObjectToPointConverter .INSTANCE .convert ((DBObject ) source .get ("second" ));
178
172
179
- return new org . springframework . data . mongodb . core . geo . Box (first , second );
173
+ return new Box (first , second );
180
174
}
181
175
}
182
176
@@ -210,7 +204,7 @@ public DBObject convert(Circle source) {
210
204
}
211
205
212
206
/**
213
- * Converts a {@link DBObject} into a {@link org.springframework.data.mongodb.core.geo. Circle}.
207
+ * Converts a {@link DBObject} into a {@link Circle}.
214
208
*
215
209
* @author Thomas Darimont
216
210
* @since 1.5
@@ -251,71 +245,6 @@ public Circle convert(DBObject source) {
251
245
}
252
246
}
253
247
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
-
319
248
/**
320
249
* Converts a {@link Sphere} into a {@link BasicDBList}.
321
250
*
@@ -422,7 +351,7 @@ public DBObject convert(Polygon source) {
422
351
}
423
352
424
353
/**
425
- * Converts a {@link BasicDBList} into a {@link org.springframework.data.mongodb.core.geo. Polygon}.
354
+ * Converts a {@link BasicDBList} into a {@link Polygon}.
426
355
*
427
356
* @author Thomas Darimont
428
357
* @since 1.5
@@ -437,7 +366,7 @@ public static enum DbObjectToPolygonConverter implements Converter<DBObject, Pol
437
366
* @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object)
438
367
*/
439
368
@ Override
440
- @ SuppressWarnings ({ "deprecation" , " unchecked" })
369
+ @ SuppressWarnings ({ "unchecked" })
441
370
public Polygon convert (DBObject source ) {
442
371
443
372
if (source == null ) {
@@ -453,7 +382,7 @@ public Polygon convert(DBObject source) {
453
382
newPoints .add (DbObjectToPointConverter .INSTANCE .convert (element ));
454
383
}
455
384
456
- return new org . springframework . data . mongodb . core . geo . Polygon (newPoints );
385
+ return new Polygon (newPoints );
457
386
}
458
387
}
459
388
@@ -472,7 +401,6 @@ public static enum GeoCommandToDbObjectConverter implements Converter<GeoCommand
472
401
* @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object)
473
402
*/
474
403
@ Override
475
- @ SuppressWarnings ("deprecation" )
476
404
public DBObject convert (GeoCommand source ) {
477
405
478
406
if (source == null ) {
@@ -493,10 +421,10 @@ public DBObject convert(GeoCommand source) {
493
421
argument .add (toList (((Circle ) shape ).getCenter ()));
494
422
argument .add (((Circle ) shape ).getRadius ().getNormalizedValue ());
495
423
496
- } else if (shape instanceof org . springframework . data . mongodb . core . geo . Circle ) {
424
+ } else if (shape instanceof Circle ) {
497
425
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 ());
500
428
501
429
} else if (shape instanceof Polygon ) {
502
430
0 commit comments