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

org.opentripplanner.ext.legacygraphqlapi.datafetchers.LegacyGraphQLStopOnTripImpl Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package org.opentripplanner.ext.legacygraphqlapi.datafetchers;

import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.opentripplanner.ext.legacygraphqlapi.generated.LegacyGraphQLDataFetchers;
import org.opentripplanner.ext.legacygraphqlapi.model.LegacyGraphQLStopOnTripModel;
import org.opentripplanner.transit.model.timetable.Trip;

public class LegacyGraphQLStopOnTripImpl
  implements LegacyGraphQLDataFetchers.LegacyGraphQLStopOnTrip {

  @Override
  public DataFetcher stop() {
    return environment -> getSource(environment).getStop();
  }

  @Override
  public DataFetcher trip() {
    return environment -> getSource(environment).getTrip();
  }

  private LegacyGraphQLStopOnTripModel getSource(DataFetchingEnvironment environment) {
    return environment.getSource();
  }
}