类 DirectionsResponse
java.lang.Object
ai.nextbillion.kits.directions.models.DirectionsJsonObject
ai.nextbillion.kits.directions.models.DirectionsResponse
- 所有已实现的接口:
Serializable
This is the root Nbmap Directions API response. Inside this class are several nested classes
chained together to make up a similar structure to the original APIs JSON response.
-
嵌套类概要
嵌套类修饰符和类型类说明static classThis builder can be used to set the values describing theDirectionsResponse. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static DirectionsResponse.Builderbuilder()Create a new instance of this class by using theDirectionsResponse.Builderclass.abstract Stringcode()String indicating the state of the response.abstract StringA string telling you of the local country codestatic DirectionsResponseCreate a new instance of this class by passing in a formatted valid JSON String.abstract Stringmessage()Optionally shows up in a directions response if an error or something unexpected occurred.abstract List<DirectionsRoute>routes()List containing all the different route options.abstract DirectionsResponse.BuilderConvert the currentDirectionsResponseto its builder holding the currently assigned values.static com.google.gson.TypeAdapter<DirectionsResponse>typeAdapter(com.google.gson.Gson gson) Gson type adapter for parsing Gson to this class.abstract Stringuuid()A universally unique identifier (UUID) for identifying and executing a similar specific route in the future.abstract List<DirectionsWaypoint>List ofDirectionsWaypointobjects.从类继承的方法 ai.nextbillion.kits.directions.models.DirectionsJsonObject
toJson
-
构造器详细资料
-
DirectionsResponse
public DirectionsResponse()
-
-
方法详细资料
-
builder
Create a new instance of this class by using theDirectionsResponse.Builderclass.- 返回:
- this classes
DirectionsResponse.Builderfor creating a new instance
-
code
String indicating the state of the response. This is a separate code than the HTTP status code. On normal valid responses, the value will be Ok. The possible responses are listed below:- Ok:200 Normal success case
- NoRoute: 200 There was no route found for the given coordinates. Check for impossible routes (e.g. routes over oceans without ferry connections).
- NoSegment: 200 No road segment could be matched for coordinates. Check for coordinates too far away from a road.
- ProfileNotFound: 404 Use a valid profile as described above
- InvalidInput: 422
- 返回:
- a string with one of the given values described in the list above
-
message
Optionally shows up in a directions response if an error or something unexpected occurred.- 返回:
- a string containing the message API Directions response with if an error occurred
-
waypoints
List ofDirectionsWaypointobjects. Eachwaypointis an input coordinate snapped to the road and path network. Thewaypointappear in the list in the order of the input coordinates.- 返回:
- list of
DirectionsWaypointobjects ordered from start of route till the end
-
routes
List containing all the different route options. It's ordered by descending recommendation rank. In other words, object 0 in the List is the highest recommended route. if you don't setAlternatives to true (default is false) in your builder this should always be a List of size 1. At most this will return 2DirectionsRouteobjects.- 返回:
- list of
DirectionsRouteobjects
-
country_code
A string telling you of the local country code- 返回:
- the country code
-
uuid
A universally unique identifier (UUID) for identifying and executing a similar specific route in the future.- 返回:
- a String representing the UUID given by the directions request
-
toBuilder
Convert the currentDirectionsResponseto its builder holding the currently assigned values. This allows you to modify a single property and then rebuild the object resulting in an updated and modifiedDirectionsResponse.- 返回:
- a
DirectionsResponse.Builderwith the same values set to match the ones defined in thisDirectionsResponse
-
typeAdapter
public static com.google.gson.TypeAdapter<DirectionsResponse> typeAdapter(com.google.gson.Gson gson) Gson type adapter for parsing Gson to this class.- 参数:
gson- the builtGsonobject- 返回:
- the type adapter for this class
-
fromJson
Create a new instance of this class by passing in a formatted valid JSON String.- 参数:
json- a formatted valid JSON string defining a GeoJson Directions Response- 返回:
- a new instance of this class defined by the values passed inside this static factory method
-