public class RoutingRequest extends Object implements Validatable
RoutingRequest encapsulates typically required request parameters
for an intermodal routing service.
In its minimal form it consists of from and to locations, at
least one mode of transport, getOptimizedFor(), and either a
departure or arrival time. The default constructor already sets
DEFAULT_DEPARTURE_TIME and
DEFAULT_OPTIMIZED_FOR.
Additional parameters, that will be different for each concrete routing
service, can be added via getAdditionalInfo(): global parameters in
this class, parameters valid only for a certain mode of transport via
RequestModeOfTransport.getAdditionalInfo(). These additional
parameters could e.g. include:
only_use_mots_provided_by = ÖBB exclude_public_transport_line = WL_28A;WL_29A exclude_provider = CAT regional_bus = no accepted_delay_minutes = 10
For optional fields where no information is provided the routing service may fall back to its specific defaults.
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_DEPARTURE_TIME |
static String |
DEFAULT_OPTIMIZED_FOR |
static String |
NOW |
| Constructor and Description |
|---|
RoutingRequest() |
public static final String NOW
public static final String DEFAULT_DEPARTURE_TIME
public static final String DEFAULT_OPTIMIZED_FOR
public Location<?> getFrom()
public Location<?> getTo()
public List<RequestModeOfTransport<?>> getModesOfTransport()
In case of intermodal routing it is guaranteed that the returned set
contains a mode of transport with
Constants.GeneralizedModeOfTransportType.FOOT.
public Optional<RequestModeOfTransport<?>> getStartModeOfTransport()
getModesOfTransport(), which
the route must start with. Only useful for intermodal routing, where
routes start and end with with foot by default.public Optional<RequestModeOfTransport<?>> getEndModeOfTransport()
getModesOfTransport(), which
the route must end with. Only useful for intermodal routing, where routes
start and end with with foot by default.public String getOptimizedFor()
public Optional<String> getSiteId()
Site the routing request should be restricted to. If
it is not set the routing service has to determine itself which
site to use, e.g. through checking the bounding boxes of the
available sitespublic Optional<Integer> getMaximumTransfers()
public Optional<String> getDepartureTime()
getArrivalTime(), it is guaranteed that exactly one of the two
times is set.
If neither departure time nor arrival time were set in the builder a departure time of 'now' is automatically added.
public Optional<ZonedDateTime> getDepartureTimeAsZonedDateTime()
getDepartureTime()public Optional<String> getArrivalTime()
getDepartureTime(), it is guaranteed that exactly one of the two
times is set.public Optional<ZonedDateTime> getArrivalTimeAsZonedDateTime()
getArrivalTime()public Set<Constants.AccessibilityRestriction> getAccessibilityRestrictions()
public List<String> getLanguages()
Locale.forLanguageTag(String)).
E.g. for navigation instructions or street or POI names. The
first language is regarded the primary language.public List<Constants.OutputFormat> getOutputFormats()
public Map<String,Object> getAdditionalInfo()
public RoutingRequest setFrom(Location<?> from)
public RoutingRequest setVia(List<Location<?>> via)
public RoutingRequest setTo(Location<?> to)
public RoutingRequest setModesOfTransport(List<RequestModeOfTransport<?>> modesOfTransport)
ModeOfTransport.STANDARD_FOOT if it is missing for the intermodal
case.public RoutingRequest setStartModeOfTransport(RequestModeOfTransport<?> startModeOfTransport)
public RoutingRequest setEndModeOfTransport(RequestModeOfTransport<?> endModeOfTransport)
public RoutingRequest setOptimizedFor(String optimizedFor)
public RoutingRequest setSiteId(String siteId)
public RoutingRequest setMaximumTransfers(Integer maximumTransfers)
public RoutingRequest setDepartureTime(ZonedDateTime departureTime)
null)public RoutingRequest setDepartureTime(String departureTime)
null)departureTime - either "NOW" or a valid date time stringpublic RoutingRequest setArrivalTime(ZonedDateTime arrivalTime)
null)public RoutingRequest setArrivalTime(String arrivalTime)
null)arrivalTime - either "NOW" or a valid date time stringpublic RoutingRequest setAccessibilityRestrictions(Set<Constants.AccessibilityRestriction> accessibilityRestrictions)
public RoutingRequest setLanguages(List<String> languages)
public RoutingRequest setOutputFormats(List<Constants.OutputFormat> outputFormats)
public RoutingRequest setAdditionalInfo(Map<String,Object> additionalInfo)
public static RoutingRequest createMinimal(Location<?> from, Location<?> to, List<RequestModeOfTransport<?>> modesOfTransport)
RoutingRequest with default departure time and default
optimized for.public void validate()
ValidatableIllegalArgumentException including a description of the
invalid state is thrown.validate in interface ValidatableCopyright © 2018. All rights reserved.