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

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

package org.opentripplanner.ext.legacygraphqlapi.datafetchers;

import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.opentripplanner.common.model.P2;
import org.opentripplanner.ext.legacygraphqlapi.generated.LegacyGraphQLDataFetchers;
import org.opentripplanner.model.plan.WalkStep;

public class LegacyGraphQLstepImpl implements LegacyGraphQLDataFetchers.LegacyGraphQLStep {

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

  @Override
  public DataFetcher lon() {
    return environment -> getSource(environment).startLocation.longitude();
  }

  @Override
  public DataFetcher lat() {
    return environment -> getSource(environment).startLocation.latitude();
  }

  @Override
  public DataFetcher>> elevationProfile() {
    return environment -> getSource(environment).elevation;
  }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy