类 DurationAdapter

java.lang.Object
com.google.gson.TypeAdapter<Duration>
ai.nextbillion.maps.internal.DurationAdapter

public class DurationAdapter
extends com.google.gson.TypeAdapter<Duration>
This class handles conversion from JSON to Distance.

Please see GSON Type Adapter for more detail.

  • 构造器概要

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

    修饰符和类型 方法 说明
    Duration read​(com.google.gson.stream.JsonReader reader)
    Read a distance object from a Directions API result and convert it to a Distance.
    void write​(com.google.gson.stream.JsonWriter writer, Duration value)
    This method is not implemented.

    从类继承的方法 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 Duration read​(com.google.gson.stream.JsonReader reader) throws java.io.IOException
      Read a distance object from a Directions API result and convert it to a Distance.

      We are expecting to receive something akin to the following:

       {
         "value": 207,
         "text": "0.1 mi"
       }
       
      指定者:
      read 在类中 com.google.gson.TypeAdapter<Duration>
      抛出:
      java.io.IOException
    • write

      public void write​(com.google.gson.stream.JsonWriter writer, Duration value) throws java.io.IOException
      This method is not implemented.
      指定者:
      write 在类中 com.google.gson.TypeAdapter<Duration>
      抛出:
      java.io.IOException