public class DistanceMatrixApiRequest
extends java.lang.Object
PendingResult.Callback<T>| Constructor and Description |
|---|
DistanceMatrixApiRequest(GeoApiContext context) |
| Modifier and Type | Method and Description |
|---|---|
DistanceMatrixApiRequest |
arrivalTime(org.joda.time.ReadableInstant arrivalTime)
Specifies the desired time of arrival for transit requests.
|
DistanceMatrixApiRequest |
avoid(DirectionsApi.RouteRestriction restriction)
Introduces restrictions to the route.
|
T |
await()
Performs the request synchronously.
|
T |
awaitIgnoreError()
Performs the request synchronously, ignoring exceptions
while performing the request and errors returned by the server.
|
void |
cancel()
Attempt to cancel the request.
|
DistanceMatrixApiRequest |
departureTime(org.joda.time.ReadableInstant departureTime)
Specifies the desired time of departure.
|
DistanceMatrixApiRequest |
destinations(LatLng... points)
One or more latitude/longitude values to which to calculate distance and time.
|
DistanceMatrixApiRequest |
destinations(java.lang.String... destinations)
One or more addresses to which to calculate distance and time.
|
A |
language(java.lang.String language)
The language in which to return results.
|
DistanceMatrixApiRequest |
mode(TravelMode mode)
Specifies the mode of transport to use when calculating directions.
|
DistanceMatrixApiRequest |
origins(LatLng... points)
One or more latitude/longitude values from which to calculate distance and time.
|
DistanceMatrixApiRequest |
origins(java.lang.String... origins)
One or more addresses from which to calculate distance and time.
|
protected A |
param(java.lang.String key,
java.lang.String val) |
protected A |
param(java.lang.String key,
com.google.maps.internal.StringJoin.UrlValue val) |
protected java.util.Map<java.lang.String,java.lang.String> |
params() |
void |
setCallback(PendingResult.Callback<T> callback)
Performs the request asynchronously, calling onResult or onFailure after
the request has been completed.
|
DistanceMatrixApiRequest |
transitModes(TransitMode... transitModes)
Specifies one or more preferred modes of transit.
|
DistanceMatrixApiRequest |
transitRoutingPreference(TransitRoutingPreference pref)
Specifies preferences for transit requests.
|
DistanceMatrixApiRequest |
units(Unit unit)
Specifies the unit system to use when expressing distance as text.
|
protected void |
validateRequest() |
public DistanceMatrixApiRequest(GeoApiContext context)
protected void validateRequest()
public DistanceMatrixApiRequest origins(java.lang.String... origins)
origins - String to geocode and use as an origin point (e.g. "New York, NY")public DistanceMatrixApiRequest origins(LatLng... points)
points - The origin points.public DistanceMatrixApiRequest destinations(java.lang.String... destinations)
destinations - String to geocode and use as a destination point (e.g. "New Jersey, NY")public DistanceMatrixApiRequest destinations(LatLng... points)
points - The destination points.public DistanceMatrixApiRequest mode(TravelMode mode)
Note that Distance Matrix requests only support TravelMode.DRIVING,
TravelMode.WALKING and TravelMode.BICYCLING.
mode - One of the travel modes supported by the Distance Matrix API.public DistanceMatrixApiRequest avoid(DirectionsApi.RouteRestriction restriction)
restriction - One of DirectionsApi.RouteRestriction.TOLLS, DirectionsApi.RouteRestriction.FERRIES or
DirectionsApi.RouteRestriction.HIGHWAYS.public DistanceMatrixApiRequest units(Unit unit)
unit - One of Unit.METRIC, Unit.IMPERIAL.public DistanceMatrixApiRequest departureTime(org.joda.time.ReadableInstant departureTime)
The departure time may be specified in two cases:
Setting the parameter to null will remove it from the API request.
departureTime - The time of departure.public DistanceMatrixApiRequest arrivalTime(org.joda.time.ReadableInstant arrivalTime)
public DistanceMatrixApiRequest transitModes(TransitMode... transitModes)
public DistanceMatrixApiRequest transitRoutingPreference(TransitRoutingPreference pref)
public final void setCallback(PendingResult.Callback<T> callback)
PendingResultsetCallback in interface PendingResult<T>public final T await()
throws java.lang.Exception
PendingResultawait in interface PendingResult<T>java.lang.Exceptionpublic final T awaitIgnoreError()
PendingResultawaitIgnoreError in interface PendingResult<T>public final void cancel()
PendingResultcancel in interface PendingResult<T>protected A param(java.lang.String key,
java.lang.String val)
protected A param(java.lang.String key,
com.google.maps.internal.StringJoin.UrlValue val)
protected java.util.Map<java.lang.String,java.lang.String> params()
public final A language(java.lang.String language)
language - The language code, e.g. "en-AU" or "es"