/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/GeoJsonLineString.java

https://github.com/spring-projects/spring-data-mongodb · Java · 57 lines · 16 code · 7 blank · 34 comment · 0 complexity · a356d168f8fbd08ec18dd90e04820003 MD5 · raw file

  1. /*
  2. * Copyright 2015-2022 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * https://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.springframework.data.mongodb.core.geo;
  17. import java.util.List;
  18. import org.springframework.data.geo.Point;
  19. /**
  20. * {@link GeoJsonLineString} is defined as list of at least 2 {@link Point}s.
  21. *
  22. * @author Christoph Strobl
  23. * @since 1.7
  24. * @see <a href="https://geojson.org/geojson-spec.html#linestring">https://geojson.org/geojson-spec.html#linestring</a>
  25. */
  26. public class GeoJsonLineString extends GeoJsonMultiPoint {
  27. private static final String TYPE = "LineString";
  28. /**
  29. * Creates a new {@link GeoJsonLineString} for the given {@link Point}s.
  30. *
  31. * @param points must not be {@literal null} and have at least 2 entries.
  32. */
  33. public GeoJsonLineString(List<Point> points) {
  34. super(points);
  35. }
  36. /**
  37. * Creates a new {@link GeoJsonLineString} for the given {@link Point}s.
  38. *
  39. * @param first must not be {@literal null}
  40. * @param second must not be {@literal null}
  41. * @param others can be {@literal null}
  42. */
  43. public GeoJsonLineString(Point first, Point second, Point... others) {
  44. super(first, second, others);
  45. }
  46. @Override
  47. public String getType() {
  48. return TYPE;
  49. }
  50. }