Class LatLngAdapter

java.lang.Object
com.google.gson.TypeAdapter<LatLng>
ai.nextbillion.maps.internal.LatLngAdapter

public class LatLngAdapter
extends com.google.gson.TypeAdapter<LatLng>
Handle conversion from varying types of latitude and longitude representations.
  • Constructor Summary

    Constructors 
    Constructor Description
    LatLngAdapter()  
  • Method Summary

    Modifier and Type Method Description
    LatLng read​(com.google.gson.stream.JsonReader reader)
    Reads in a JSON object and try to create a LatLng in one of the following formats.
    void write​(com.google.gson.stream.JsonWriter out, LatLng value)
    Not supported.

    Methods inherited from class com.google.gson.TypeAdapter

    fromJson, fromJson, fromJsonTree, nullSafe, toJson, toJson, toJsonTree

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • read

      public LatLng read​(com.google.gson.stream.JsonReader reader) throws java.io.IOException
      Reads in a JSON object and try to create a LatLng in one of the following formats.
      {
         "lat" : -33.8353684,
         "lng" : 140.8527069
       }
      
       {
         "latitude": -33.865257570508334,
         "longitude": 151.19287000481452
       }
      Specified by:
      read in class com.google.gson.TypeAdapter<LatLng>
      Throws:
      java.io.IOException
    • write

      public void write​(com.google.gson.stream.JsonWriter out, LatLng value) throws java.io.IOException
      Not supported.
      Specified by:
      write in class com.google.gson.TypeAdapter<LatLng>
      Throws:
      java.io.IOException