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

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

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.LegacyGraphQLStopOnRouteModel;
import org.opentripplanner.model.Route;

public class LegacyGraphQLStopOnRouteImpl
        implements LegacyGraphQLDataFetchers.LegacyGraphQLStopOnRoute {

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

    @Override
    public DataFetcher route() {
        return environment -> getSource(environment).getRoute();
    }

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