public abstract static class MatrixResponse.Builder
extends java.lang.Object
MatrixResponse
.Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
abstract MatrixResponse |
build()
Build a new
MatrixResponse object. |
abstract MatrixResponse.Builder |
code(java.lang.String code)
String indicating the state of the response.
|
abstract MatrixResponse.Builder |
destinations(java.util.List<com.mapbox.api.directions.v5.models.DirectionsWaypoint> destinations)
List of
DirectionsWaypoint objects. |
abstract MatrixResponse.Builder |
distances(java.util.List<java.lang.Double[]> distances)
Distances as a list of arrays representing the matrix in row-major order.
|
abstract MatrixResponse.Builder |
durations(java.util.List<java.lang.Double[]> durations)
Durations as array of arrays representing the matrix in row-major order.
|
abstract MatrixResponse.Builder |
sources(java.util.List<com.mapbox.api.directions.v5.models.DirectionsWaypoint> sources)
List of
DirectionsWaypoint objects. |
public abstract MatrixResponse.Builder code(@NonNull java.lang.String code)
Ok
.
On error, the server responds with different HTTP status codes. For responses with HTTP status codes lower than 500, the JSON response body includes the code property, which may be used by client programs to manage control flow. The response body may also include a message property, with a human-readable explanation of the error. If a server error occurs, the HTTP status code will be 500 or higher and the response will not include a code property.
Note that in cases where no route is found between a source and destination, no error will be returned, but instead the respective value in the durations matrix will be null.
code
- "Ok", "NoRoute", "ProfileNotFound", or "InvalidInput"public abstract MatrixResponse.Builder destinations(@Nullable java.util.List<com.mapbox.api.directions.v5.models.DirectionsWaypoint> destinations)
DirectionsWaypoint
objects. Each waypoint is an input coordinate snapped to
the road and path network. The waypoints appear in the list in the order of the input
coordinates, or in the order as specified in the destinations query parameter.destinations
- list object with each item being a DirectionsWaypoint
public abstract MatrixResponse.Builder sources(@Nullable java.util.List<com.mapbox.api.directions.v5.models.DirectionsWaypoint> sources)
DirectionsWaypoint
objects. Each waypoints is an input coordinate snapped to
the road and path network. The waypoints appear in the list in the order of the input
coordinates, or in the order as specified in the sources query parameter.sources
- list object with each item being a DirectionsWaypoint
public abstract MatrixResponse.Builder durations(@Nullable java.util.List<java.lang.Double[]> durations)
durations
- an array of array with each entry being a duration value given in seconds.public abstract MatrixResponse.Builder distances(@Nullable java.util.List<java.lang.Double[]> distances)
distances
- an array of array with each entry being a distance value given in meterspublic abstract MatrixResponse build()
MatrixResponse
object.MatrixResponse
using the provided values in this builder