
org.opentripplanner.ext.transmodelapi.mapping.PlaceMapper 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
package org.opentripplanner.ext.transmodelapi.mapping;
import java.util.List;
import java.util.stream.Collectors;
import org.opentripplanner.ext.transmodelapi.model.TransmodelPlaceType;
import org.opentripplanner.routing.graphfinder.PlaceType;
/**
* Map to/from {@link TransmodelPlaceType}
*/
public class PlaceMapper {
public static List mapToDomain(List api) {
if (api == null) {
return null;
}
return api.stream().map(PlaceMapper::mapToDomain).distinct().collect(Collectors.toList());
}
private static PlaceType mapToDomain(TransmodelPlaceType api) {
if (api == null) {
return null;
}
return switch (api) {
case QUAY, STOP_PLACE -> PlaceType.STOP;
case BICYCLE_RENT -> PlaceType.VEHICLE_RENT;
case BIKE_PARK -> PlaceType.BIKE_PARK;
case CAR_PARK -> PlaceType.CAR_PARK;
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy