@Override @SuppressWarnings({ "unchecked" }) public Polygon convert(Document source) { if (source == null) { return null; } List<Document> points = (List<Document>) source.get("points"); List<Point> newPoints = new ArrayList<>(points.size()); for (Document element : points) { Assert.notNull(element, "Point elements of polygon must not be null!"); newPoints.add(DocumentToPointConverter.INSTANCE.convert(element)); } return new Polygon(newPoints); } }
@Override @SuppressWarnings({ "unchecked" }) public Polygon convert(Document source) { if (source == null) { return null; } List<Document> points = (List<Document>) source.get("points"); List<Point> newPoints = new ArrayList<>(points.size()); for (Document element : points) { Assert.notNull(element, "Point elements of polygon must not be null!"); newPoints.add(DocumentToPointConverter.INSTANCE.convert(element)); } return new Polygon(newPoints); } }