org.opentripplanner.gtfs.mapping.BrandingMapper 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.gtfs.mapping;
import javax.annotation.Nullable;
import org.onebusaway.gtfs.model.Route;
import org.opentripplanner.transit.model.framework.FeedScopedId;
import org.opentripplanner.transit.model.organization.Branding;
/** Responsible for mapping GTFS Route into the OTP Branding model. */
public class BrandingMapper {
/**
* Convert GTFS Route entity into OTP Branding model.
*
* @param route GTFS Route entity
* @return OTP branding model. Null if route branding url is not present.
*/
@Nullable
public Branding map(Route route) {
if (route.getBrandingUrl() == null) {
return null;
}
// Make an id from the url, the id is required
var id = new FeedScopedId(route.getId().getAgencyId(), route.getBrandingUrl());
return Branding.of(id).withUrl(route.getBrandingUrl()).build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy