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

org.opentripplanner.apis.gtfs.mapping.RealtimeStateMapper Maven / Gradle / Ivy

The newest version!
package org.opentripplanner.apis.gtfs.mapping;

import javax.annotation.Nullable;
import org.opentripplanner.apis.gtfs.generated.GraphQLTypes;
import org.opentripplanner.transit.model.timetable.RealTimeState;

/**
 * Maps from the internal model to the API one.
 */
public class RealtimeStateMapper {

  public static GraphQLTypes.GraphQLRealtimeState map(@Nullable RealTimeState state) {
    if (state == null) return null;
    return switch (state) {
      case SCHEDULED -> GraphQLTypes.GraphQLRealtimeState.SCHEDULED;
      case UPDATED -> GraphQLTypes.GraphQLRealtimeState.UPDATED;
      case CANCELED, DELETED -> GraphQLTypes.GraphQLRealtimeState.CANCELED;
      case ADDED -> GraphQLTypes.GraphQLRealtimeState.ADDED;
      case MODIFIED -> GraphQLTypes.GraphQLRealtimeState.MODIFIED;
    };
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy