
org.opentripplanner.apis.transmodel.mapping.ViaLocationMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
The newest version!
package org.opentripplanner.apis.transmodel.mapping;
import static org.opentripplanner.routing.api.response.InputField.INTERMEDIATE_PLACE;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import org.opentripplanner.routing.api.request.ViaLocation;
import org.opentripplanner.routing.api.response.RoutingError;
import org.opentripplanner.routing.api.response.RoutingErrorCode;
import org.opentripplanner.routing.error.RoutingValidationException;
class ViaLocationMapper {
static ViaLocation mapViaLocation(Map viaLocation) {
try {
return new ViaLocation(
GenericLocationMapper.toGenericLocation(viaLocation),
false,
(Duration) viaLocation.get("minSlack"),
(Duration) viaLocation.get("maxSlack")
);
} catch (IllegalArgumentException e) {
throw new RoutingValidationException(
List.of(new RoutingError(RoutingErrorCode.LOCATION_NOT_FOUND, INTERMEDIATE_PLACE))
);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy