@Override public Circle convert(Document source) { if (source == null) { return null; } Document center = (Document) source.get("center"); Number radius = (Number) source.get("radius"); Assert.notNull(center, "Center must not be null!"); Assert.notNull(radius, "Radius must not be null!"); Distance distance = new Distance(toPrimitiveDoubleValue(radius)); if (source.containsKey("metric")) { String metricString = (String) source.get("metric"); Assert.notNull(metricString, "Metric must not be null!"); distance = distance.in(Metrics.valueOf(metricString)); } return new Circle(DocumentToPointConverter.INSTANCE.convert(center), distance); } }
@Override public Sphere convert(Document source) { if (source == null) { return null; } Document center = (Document) source.get("center"); Number radius = (Number) source.get("radius"); Assert.notNull(center, "Center must not be null!"); Assert.notNull(radius, "Radius must not be null!"); Distance distance = new Distance(toPrimitiveDoubleValue(radius)); if (source.containsKey("metric")) { String metricString = (String) source.get("metric"); Assert.notNull(metricString, "Metric must not be null!"); distance = distance.in(Metrics.valueOf(metricString)); } return new Sphere(DocumentToPointConverter.INSTANCE.convert(center), distance); } }
@Override public Sphere convert(Document source) { if (source == null) { return null; } Document center = (Document) source.get("center"); Number radius = (Number) source.get("radius"); Assert.notNull(center, "Center must not be null!"); Assert.notNull(radius, "Radius must not be null!"); Distance distance = new Distance(toPrimitiveDoubleValue(radius)); if (source.containsKey("metric")) { String metricString = (String) source.get("metric"); Assert.notNull(metricString, "Metric must not be null!"); distance = distance.in(Metrics.valueOf(metricString)); } return new Sphere(DocumentToPointConverter.INSTANCE.convert(center), distance); } }
@Override public Circle convert(Document source) { if (source == null) { return null; } Document center = (Document) source.get("center"); Number radius = (Number) source.get("radius"); Assert.notNull(center, "Center must not be null!"); Assert.notNull(radius, "Radius must not be null!"); Distance distance = new Distance(toPrimitiveDoubleValue(radius)); if (source.containsKey("metric")) { String metricString = (String) source.get("metric"); Assert.notNull(metricString, "Metric must not be null!"); distance = distance.in(Metrics.valueOf(metricString)); } return new Circle(DocumentToPointConverter.INSTANCE.convert(center), distance); } }