public abstract class DirectionsRoute extends DirectionsJsonObject
Modifier and Type | Class and Description |
---|---|
static class |
DirectionsRoute.Builder
This builder can be used to set the values describing the
DirectionsRoute . |
Constructor and Description |
---|
DirectionsRoute() |
Modifier and Type | Method and Description |
---|---|
static DirectionsRoute.Builder |
builder()
Create a new instance of this class by using the
DirectionsRoute.Builder class. |
abstract java.lang.Double |
distance()
The distance traveled from origin to destination.
|
abstract java.lang.Double |
duration()
The estimated travel time from origin to destination.
|
abstract java.lang.Double |
durationTypical()
The typical travel time from this route's origin to destination.
|
static DirectionsRoute |
fromJson(java.lang.String json)
Create a new instance of this class by passing in a formatted valid JSON String.
|
static DirectionsRoute |
fromJson(java.lang.String json,
RouteOptions routeOptions,
java.lang.String requestUuid)
Create a new instance of this class by passing in a formatted valid JSON String.
|
abstract java.lang.String |
geometry()
Gives the geometry of the route.
|
abstract java.util.List<RouteLeg> |
legs()
A Leg is a route between only two waypoints.
|
abstract java.lang.String |
requestUuid()
The universally unique identifier of the request that produced this route.
|
abstract java.lang.String |
routeIndex()
The index of this route in the original network response.
|
abstract RouteOptions |
routeOptions()
Holds onto the parameter information used when making the directions request.
|
abstract DirectionsRoute.Builder |
toBuilder()
Convert the current
DirectionsRoute to its builder holding the currently assigned
values. |
abstract java.util.List<TollCost> |
tollCosts() |
static com.google.gson.TypeAdapter<DirectionsRoute> |
typeAdapter(com.google.gson.Gson gson)
Gson type adapter for parsing Gson to this class.
|
abstract java.lang.String |
voiceLanguage()
String of the language to be used for voice instructions.
|
abstract java.lang.Double |
weight()
The calculated weight of the route.
|
abstract java.lang.String |
weightName()
The name of the weight profile used while calculating during extraction phase.
|
getUnrecognizedJsonProperties, getUnrecognizedPropertiesNames, getUnrecognizedProperty, toJson
public static DirectionsRoute.Builder builder()
DirectionsRoute.Builder
class.DirectionsRoute.Builder
for creating a new instance@Nullable public abstract java.lang.String routeIndex()
@NonNull public abstract java.lang.Double distance()
@NonNull public abstract java.lang.Double duration()
@Nullable @SerializedName(value="duration_typical") public abstract java.lang.Double durationTypical()
@Nullable public abstract java.lang.String geometry()
@Nullable public abstract java.lang.Double weight()
double
value@Nullable @SerializedName(value="weight_name") public abstract java.lang.String weightName()
routability
which is duration based, with additional penalties for less desirable
maneuvers.@Nullable public abstract java.util.List<RouteLeg> legs()
RouteLeg
objects@Nullable public abstract RouteOptions routeOptions()
RouteOptions
s object which holds onto critical information from the request
that cannot be derived directly from the directions route@Nullable @SerializedName(value="voiceLocale") public abstract java.lang.String voiceLanguage()
@Nullable public abstract java.lang.String requestUuid()
@Nullable @SerializedName(value="toll_costs") public abstract java.util.List<TollCost> tollCosts()
public abstract DirectionsRoute.Builder toBuilder()
DirectionsRoute
to 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 modified DirectionsRoute
.DirectionsRoute.Builder
with the same values set to match the ones defined
in this DirectionsRoute
public static com.google.gson.TypeAdapter<DirectionsRoute> typeAdapter(com.google.gson.Gson gson)
gson
- the built Gson
objectpublic static DirectionsRoute fromJson(@NonNull java.lang.String json)
If you're using the provided route with the Mapbox Navigation SDK, also see
fromJson(String, RouteOptions, String)
.
json
- a formatted valid JSON string defining a GeoJson Directions Routepublic static DirectionsRoute fromJson(@NonNull java.lang.String json, @Nullable RouteOptions routeOptions, @Nullable java.lang.String requestUuid)
The parameters of RouteOptions
that were used to make the original route request
as well as the String
UUID of the original response are needed
by the Mapbox Navigation SDK to support correct rerouting and route refreshing.
json
- a formatted valid JSON string defining a GeoJson Directions RouterouteOptions
- options that were used during the original route requestrequestUuid
- UUID of the request found in the body of the original response,
see "response.body.uuid"RouteOptions.fromUrl(java.net.URL)
,
RouteOptions.fromJson(String)