DATAMONGO-1466 - Polishing.
Just some minor code style improvements. Original pull request: #561.
This commit is contained in:
committed by
Mark Paluch
parent
ae18958955
commit
33863999e6
@@ -50,7 +50,7 @@ import com.mongodb.BasicDBList;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper class to contain useful geo structure converters for the usage with Mongo.
|
* Wrapper class to contain useful geo structure converters for the usage with Mongo.
|
||||||
*
|
*
|
||||||
* @author Thomas Darimont
|
* @author Thomas Darimont
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
* @author Christoph Strobl
|
* @author Christoph Strobl
|
||||||
@@ -66,7 +66,7 @@ abstract class GeoConverters {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the geo converters to be registered.
|
* Returns the geo converters to be registered.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -98,12 +98,12 @@ abstract class GeoConverters {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a {@link List} of {@link Double}s into a {@link Point}.
|
* Converts a {@link List} of {@link Double}s into a {@link Point}.
|
||||||
*
|
*
|
||||||
* @author Thomas Darimont
|
* @author Thomas Darimont
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
@ReadingConverter
|
@ReadingConverter
|
||||||
static enum DocumentToPointConverter implements Converter<Document, Point> {
|
enum DocumentToPointConverter implements Converter<Document, Point> {
|
||||||
|
|
||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
@@ -130,11 +130,11 @@ abstract class GeoConverters {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a {@link Point} into a {@link List} of {@link Double}s.
|
* Converts a {@link Point} into a {@link List} of {@link Double}s.
|
||||||
*
|
*
|
||||||
* @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;
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ abstract class GeoConverters {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a {@link Document} into a {@link Circle}.
|
* Converts a {@link Document} into a {@link Circle}.
|
||||||
*
|
*
|
||||||
* @author Thomas Darimont
|
* @author Thomas Darimont
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
@@ -278,8 +278,8 @@ 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;
|
||||||
|
|
||||||
@@ -792,7 +792,7 @@ abstract class GeoConverters {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a coordinate pairs nested in in {@link BasicDBList} into {@link GeoJsonPoint}s.
|
* Converts a coordinate pairs nested in in {@link BasicDBList} into {@link GeoJsonPoint}s.
|
||||||
*
|
*
|
||||||
* @param listOfCoordinatePairs
|
* @param listOfCoordinatePairs
|
||||||
* @return
|
* @return
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
@@ -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) {
|
||||||
|
|
||||||
@@ -816,7 +816,7 @@ abstract class GeoConverters {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a coordinate pairs nested in in {@link BasicDBList} into {@link GeoJsonPolygon}.
|
* Converts a coordinate pairs nested in in {@link BasicDBList} into {@link GeoJsonPolygon}.
|
||||||
*
|
*
|
||||||
* @param dbList
|
* @param dbList
|
||||||
* @return
|
* @return
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
|
|||||||
Reference in New Issue
Block a user