All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentripplanner.api.mapping.BookingInfoMapper Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package org.opentripplanner.api.mapping;

import org.opentripplanner.api.model.ApiBookingInfo;
import org.opentripplanner.model.BookingInfo;

public class BookingInfoMapper {

  static ApiBookingInfo mapBookingInfo(BookingInfo info, boolean isPickup) {
    if (info == null) {
      return null;
    }

    return new ApiBookingInfo(
      ContactInfoMapper.mapContactInfo(info.getContactInfo()),
      BookingMethodMapper.mapBookingMethods(info.bookingMethods()),
      BookingTimeMapper.mapBookingTime(info.getEarliestBookingTime()),
      BookingTimeMapper.mapBookingTime(info.getLatestBookingTime()),
      info.getMinimumBookingNotice(),
      info.getMaximumBookingNotice(),
      info.getMessage(),
      // we only want to show the pick up message for pickups
      isPickup ? info.getPickupMessage() : null,
      // and only the drop off message for drop offs
      !isPickup ? info.getDropOffMessage() : null
    );
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy