Class RouteRequestParams
- java.lang.Object
-
- RouteRequestParams
-
public class RouteRequestParams extends java.lang.Object
The RouteRequestParams contains the fields received from the browser in the shortest-route request. This class will primarily be used by the MapServer to unpack data received from the web browser before sending calling the shortestPath method. This class can either be instantiated through a Spark request query map, or through the Builder class for mocking browser requests during unit testing of Router.shortestPath.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RouteRequestParams.Builder
-
Field Summary
Fields Modifier and Type Field Description double
endLat
The end point latitude.double
endLon
The end point longitude.private static java.lang.String[]
REQUIRED_PARAMS
Route requests to the server must have the following keys in the params map.double
startLat
The start point latitude.double
startLon
The start point longitude.
-
Constructor Summary
Constructors Modifier Constructor Description private
RouteRequestParams()
Constructor with private access to prevent direct instantiation of a RasterResultParams instance.private
RouteRequestParams(double startLat, double startLon, double endLat, double endLon)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RouteRequestParams
from(java.util.Map<java.lang.String,java.lang.String[]> req)
Validate and return a parameter map of the required request parameters.
-
-
-
Field Detail
-
startLat
public final double startLat
The start point latitude.
-
startLon
public final double startLon
The start point longitude.
-
endLat
public final double endLat
The end point latitude.
-
endLon
public final double endLon
The end point longitude.
-
REQUIRED_PARAMS
private static final java.lang.String[] REQUIRED_PARAMS
Route requests to the server must have the following keys in the params map.
-
-
Constructor Detail
-
RouteRequestParams
private RouteRequestParams()
Constructor with private access to prevent direct instantiation of a RasterResultParams instance. Use the the factory method, from, instead.
-
RouteRequestParams
private RouteRequestParams(double startLat, double startLon, double endLat, double endLon)
-
-
Method Detail
-
from
public static RouteRequestParams from(java.util.Map<java.lang.String,java.lang.String[]> req)
Validate and return a parameter map of the required request parameters. Requires that all input parameters are doubles.- Parameters:
req
- The queryParams map from a Spark HTTP Request.- Returns:
- A populated map of input parameter to it's numerical value.
-
-