Package ai.nextbillion.maps.internal
Class 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.
-
Constructor Summary
Constructors Constructor Description DurationAdapter() -
Method Summary
-
Constructor Details
-
DurationAdapter
public DurationAdapter()
-
-
Method Details
-
read
Read a distance object from a Directions API result and convert it to aDistance.We are expecting to receive something akin to the following:
{ "value": 207, "text": "0.1 mi" }- Specified by:
readin classcom.google.gson.TypeAdapter<Duration>- Throws:
java.io.IOException
-
write
public void write(com.google.gson.stream.JsonWriter writer, Duration value) throws java.io.IOExceptionThis method is not implemented.- Specified by:
writein classcom.google.gson.TypeAdapter<Duration>- Throws:
java.io.IOException
-