Browse Source

DATAMONGO-1466 - Polishing.

Just some minor code style improvements.

Original pull request: #561.
pull/558/merge
Christoph Strobl 8 years ago committed by Mark Paluch
parent
commit
e38e7d89f4
  1. 58
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/GeoConverters.java

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

@ -103,7 +103,7 @@ abstract class GeoConverters {
* @since 1.5 * @since 1.5
*/ */
@ReadingConverter @ReadingConverter
static enum DocumentToPointConverter implements Converter<Document, Point> { enum DocumentToPointConverter implements Converter<Document, Point> {
INSTANCE; INSTANCE;
@ -134,7 +134,7 @@ abstract class GeoConverters {
* @author Thomas Darimont * @author Thomas Darimont
* @since 1.5 * @since 1.5
*/ */
static enum PointToDocumentConverter implements Converter<Point, Document> { enum PointToDocumentConverter implements Converter<Point, Document> {
INSTANCE; INSTANCE;
@ -149,13 +149,13 @@ abstract class GeoConverters {
} }
/** /**
* Converts a {@link Box} into a {@link BasicDBList}. * Converts a {@link Box} into a {@link Document}.
* *
* @author Thomas Darimont * @author Thomas Darimont
* @since 1.5 * @since 1.5
*/ */
@WritingConverter @WritingConverter
static enum BoxToDocumentConverter implements Converter<Box, Document> { enum BoxToDocumentConverter implements Converter<Box, Document> {
INSTANCE; INSTANCE;
@ -178,13 +178,13 @@ abstract class GeoConverters {
} }
/** /**
* Converts a {@link BasicDBList} into a {@link Box}. * Converts a {@link Document} into a {@link Box}.
* *
* @author Thomas Darimont * @author Thomas Darimont
* @since 1.5 * @since 1.5
*/ */
@ReadingConverter @ReadingConverter
static enum DocumentToBoxConverter implements Converter<Document, Box> { enum DocumentToBoxConverter implements Converter<Document, Box> {
INSTANCE; INSTANCE;
@ -207,12 +207,12 @@ abstract class GeoConverters {
} }
/** /**
* Converts a {@link Circle} into a {@link BasicDBList}. * Converts a {@link Circle} into a {@link Document}.
* *
* @author Thomas Darimont * @author Thomas Darimont
* @since 1.5 * @since 1.5
*/ */
static enum CircleToDocumentConverter implements Converter<Circle, Document> { enum CircleToDocumentConverter implements Converter<Circle, Document> {
INSTANCE; INSTANCE;
@ -278,7 +278,7 @@ abstract class GeoConverters {
} }
/** /**
* Converts a {@link Sphere} into a {@link BasicDBList}. * Converts a {@link Sphere} into a {@link Document}.
* *
* @author Thomas Darimont * @author Thomas Darimont
* @since 1.5 * @since 1.5
@ -307,13 +307,13 @@ abstract class GeoConverters {
} }
/** /**
* Converts a {@link BasicDBList} into a {@link Sphere}. * Converts a {@link Document} into a {@link Sphere}.
* *
* @author Thomas Darimont * @author Thomas Darimont
* @since 1.5 * @since 1.5
*/ */
@ReadingConverter @ReadingConverter
static enum DocumentToSphereConverter implements Converter<Document, Sphere> { enum DocumentToSphereConverter implements Converter<Document, Sphere> {
INSTANCE; INSTANCE;
@ -349,12 +349,12 @@ abstract class GeoConverters {
} }
/** /**
* Converts a {@link Polygon} into a {@link BasicDBList}. * Converts a {@link Polygon} into a {@link Document}.
* *
* @author Thomas Darimont * @author Thomas Darimont
* @since 1.5 * @since 1.5
*/ */
static enum PolygonToDocumentConverter implements Converter<Polygon, Document> { enum PolygonToDocumentConverter implements Converter<Polygon, Document> {
INSTANCE; INSTANCE;
@ -370,7 +370,7 @@ abstract class GeoConverters {
} }
List<Point> points = source.getPoints(); List<Point> points = source.getPoints();
List<Document> pointTuples = new ArrayList<Document>(points.size()); List<Document> pointTuples = new ArrayList<>(points.size());
for (Point point : points) { for (Point point : points) {
pointTuples.add(PointToDocumentConverter.INSTANCE.convert(point)); pointTuples.add(PointToDocumentConverter.INSTANCE.convert(point));
@ -383,13 +383,13 @@ abstract class GeoConverters {
} }
/** /**
* Converts a {@link BasicDBList} into a {@link Polygon}. * Converts a {@link Document} into a {@link Polygon}.
* *
* @author Thomas Darimont * @author Thomas Darimont
* @since 1.5 * @since 1.5
*/ */
@ReadingConverter @ReadingConverter
static enum DocumentToPolygonConverter implements Converter<Document, Polygon> { enum DocumentToPolygonConverter implements Converter<Document, Polygon> {
INSTANCE; INSTANCE;
@ -406,7 +406,7 @@ abstract class GeoConverters {
} }
List<Document> points = (List<Document>) source.get("points"); List<Document> points = (List<Document>) source.get("points");
List<Point> newPoints = new ArrayList<Point>(points.size()); List<Point> newPoints = new ArrayList<>(points.size());
for (Document element : points) { for (Document element : points) {
@ -419,12 +419,12 @@ abstract class GeoConverters {
} }
/** /**
* Converts a {@link Sphere} into a {@link BasicDBList}. * Converts a {@link Sphere} into a {@link Document}.
* *
* @author Thomas Darimont * @author Thomas Darimont
* @since 1.5 * @since 1.5
*/ */
static enum GeoCommandToDocumentConverter implements Converter<GeoCommand, Document> { enum GeoCommandToDocumentConverter implements Converter<GeoCommand, Document> {
INSTANCE; INSTANCE;
@ -484,7 +484,7 @@ abstract class GeoConverters {
* @since 1.7 * @since 1.7
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
static enum GeoJsonToDocumentConverter implements Converter<GeoJson, Document> { enum GeoJsonToDocumentConverter implements Converter<GeoJson, Document> {
INSTANCE; INSTANCE;
@ -547,7 +547,7 @@ abstract class GeoConverters {
* @author Christoph Strobl * @author Christoph Strobl
* @since 1.7 * @since 1.7
*/ */
static enum GeoJsonPointToDocumentConverter implements Converter<GeoJsonPoint, Document> { enum GeoJsonPointToDocumentConverter implements Converter<GeoJsonPoint, Document> {
INSTANCE; INSTANCE;
@ -565,7 +565,7 @@ abstract class GeoConverters {
* @author Christoph Strobl * @author Christoph Strobl
* @since 1.7 * @since 1.7
*/ */
static enum GeoJsonPolygonToDocumentConverter implements Converter<GeoJsonPolygon, Document> { enum GeoJsonPolygonToDocumentConverter implements Converter<GeoJsonPolygon, Document> {
INSTANCE; INSTANCE;
@ -583,7 +583,7 @@ abstract class GeoConverters {
* @author Christoph Strobl * @author Christoph Strobl
* @since 1.7 * @since 1.7
*/ */
static enum DocumentToGeoJsonPointConverter implements Converter<Document, GeoJsonPoint> { enum DocumentToGeoJsonPointConverter implements Converter<Document, GeoJsonPoint> {
INSTANCE; INSTANCE;
@ -611,7 +611,7 @@ abstract class GeoConverters {
* @author Christoph Strobl * @author Christoph Strobl
* @since 1.7 * @since 1.7
*/ */
static enum DocumentToGeoJsonPolygonConverter implements Converter<Document, GeoJsonPolygon> { enum DocumentToGeoJsonPolygonConverter implements Converter<Document, GeoJsonPolygon> {
INSTANCE; INSTANCE;
@ -656,7 +656,7 @@ abstract class GeoConverters {
String.format("Cannot convert type '%s' to MultiPolygon.", source.get("type"))); String.format("Cannot convert type '%s' to MultiPolygon.", source.get("type")));
List dbl = (List) source.get("coordinates"); List dbl = (List) source.get("coordinates");
List<GeoJsonPolygon> polygones = new ArrayList<GeoJsonPolygon>(); List<GeoJsonPolygon> polygones = new ArrayList<>();
for (Object polygon : dbl) { for (Object polygon : dbl) {
polygones.add(toGeoJsonPolygon((List) polygon)); polygones.add(toGeoJsonPolygon((List) polygon));
@ -670,7 +670,7 @@ abstract class GeoConverters {
* @author Christoph Strobl * @author Christoph Strobl
* @since 1.7 * @since 1.7
*/ */
static enum DocumentToGeoJsonLineStringConverter implements Converter<Document, GeoJsonLineString> { enum DocumentToGeoJsonLineStringConverter implements Converter<Document, GeoJsonLineString> {
INSTANCE; INSTANCE;
@ -698,7 +698,7 @@ abstract class GeoConverters {
* @author Christoph Strobl * @author Christoph Strobl
* @since 1.7 * @since 1.7
*/ */
static enum DocumentToGeoJsonMultiPointConverter implements Converter<Document, GeoJsonMultiPoint> { enum DocumentToGeoJsonMultiPointConverter implements Converter<Document, GeoJsonMultiPoint> {
INSTANCE; INSTANCE;
@ -726,7 +726,7 @@ abstract class GeoConverters {
* @author Christoph Strobl * @author Christoph Strobl
* @since 1.7 * @since 1.7
*/ */
static enum DocumentToGeoJsonMultiLineStringConverter implements Converter<Document, GeoJsonMultiLineString> { enum DocumentToGeoJsonMultiLineStringConverter implements Converter<Document, GeoJsonMultiLineString> {
INSTANCE; INSTANCE;
@ -800,7 +800,7 @@ abstract class GeoConverters {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
static List<Point> toListOfPoint(List listOfCoordinatePairs) { static List<Point> toListOfPoint(List listOfCoordinatePairs) {
List<Point> points = new ArrayList<Point>(); List<Point> points = new ArrayList<>();
for (Object point : listOfCoordinatePairs) { for (Object point : listOfCoordinatePairs) {

Loading…
Cancel
Save