Class GeoLocation

java.lang.Object
co.elastic.clients.elasticsearch._types.GeoLocation
All Implemented Interfaces:
JsonpSerializable, TaggedUnion<GeoLocation.Kind,​java.lang.Object>

@JsonpDeserializable
public class GeoLocation
extends java.lang.Object
implements TaggedUnion<GeoLocation.Kind,​java.lang.Object>, JsonpSerializable
A latitude/longitude as a 2 dimensional point. It can be represented in various ways:
  • as a {lat, long} object
  • as a geo hash value
  • as a [lon, lat] array
  • as a string in "<lat>, <lon>" or WKT point formats
See Also:
API specification
  • Field Details

  • Method Details

    • _kind

      public final GeoLocation.Kind _kind()
      Description copied from interface: TaggedUnion
      Get the of the kind of variant held by this object.
      Specified by:
      _kind in interface TaggedUnion<GeoLocation.Kind,​java.lang.Object>
      Returns:
      the variant kind
    • _get

      public final java.lang.Object _get()
      Specified by:
      _get in interface TaggedUnion<GeoLocation.Kind,​java.lang.Object>
    • of

      public static GeoLocation of​(java.util.function.Function<GeoLocation.Builder,​ObjectBuilder<GeoLocation>> fn)
    • isCoords

      public boolean isCoords()
      Is this variant instance of kind coords?
    • coords

      public java.util.List<java.lang.Double> coords()
      Get the coords variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the coords kind.
    • isGeohash

      public boolean isGeohash()
      Is this variant instance of kind geohash?
    • geohash

      public GeoHashLocation geohash()
      Get the geohash variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the geohash kind.
    • isLatlon

      public boolean isLatlon()
      Is this variant instance of kind latlon?
    • latlon

      public LatLonGeoLocation latlon()
      Get the latlon variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the latlon kind.
    • isText

      public boolean isText()
      Is this variant instance of kind text?
    • text

      public java.lang.String text()
      Get the text variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the text kind.
    • serialize

      public void serialize​(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
      Specified by:
      serialize in interface JsonpSerializable