类 GeolocationResponseAdapter

java.lang.Object
com.google.gson.TypeAdapter<GeolocationApi.Response>
ai.nextbillion.maps.internal.GeolocationResponseAdapter

public class GeolocationResponseAdapter
extends com.google.gson.TypeAdapter<GeolocationApi.Response>
  • 构造器概要

    构造器 
    构造器 说明
    GeolocationResponseAdapter()  
  • 方法概要

    修饰符和类型 方法 说明
    GeolocationApi.Response read​(com.google.gson.stream.JsonReader reader)
    Reads in a JSON object to create a Geolocation Response.
    void write​(com.google.gson.stream.JsonWriter out, GeolocationApi.Response value)
    Not supported.

    从类继承的方法 com.google.gson.TypeAdapter

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

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

  • 方法详细资料

    • read

      public GeolocationApi.Response read​(com.google.gson.stream.JsonReader reader) throws java.io.IOException
      Reads in a JSON object to create a Geolocation Response. See: https://developers.google.com/maps/documentation/geolocation/intro#responses

      Success Case:

         {
           "location": {
             "lat": 51.0,
             "lng": -0.1
           },
           "accuracy": 1200.4
         }
       
      Error Case: The response contains an object with a single error object with the following keys:

      code: This is the same as the HTTP status of the response. message: A short description of the error. errors: A list of errors which occurred. Each error contains an identifier for the type of error (the reason) and a short description (the message). For example, sending invalid JSON will return the following error:

         {
           "error": {
             "errors": [ {
                 "domain": "geolocation",
                 "reason": "notFound",
                 "message": "Not Found",
                 "debugInfo": "status: ZERO_RESULTS\ncom.google.api.server.core.Fault: Immu...
             }],
             "code": 404,
             "message": "Not Found"
           }
         }
       
      指定者:
      read 在类中 com.google.gson.TypeAdapter<GeolocationApi.Response>
      抛出:
      java.io.IOException
    • write

      public void write​(com.google.gson.stream.JsonWriter out, GeolocationApi.Response value) throws java.io.IOException
      Not supported.
      指定者:
      write 在类中 com.google.gson.TypeAdapter<GeolocationApi.Response>
      抛出:
      java.io.IOException