org.opentripplanner.ext.legacygraphqlapi.datafetchers.LegacyGraphQLBikeParkImpl Maven / Gradle / Ivy
package org.opentripplanner.ext.legacygraphqlapi.datafetchers;
import graphql.relay.Relay;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.opentripplanner.ext.legacygraphqlapi.generated.LegacyGraphQLDataFetchers;
import org.opentripplanner.routing.bike_park.BikePark;
public class LegacyGraphQLBikeParkImpl implements LegacyGraphQLDataFetchers.LegacyGraphQLBikePark {
@Override
public DataFetcher id() {
return environment -> new Relay.ResolvedGlobalId(
"BikePark",
getSource(environment).id
);
}
@Override
public DataFetcher bikeParkId() {
return environment -> getSource(environment).id;
}
@Override
public DataFetcher name() {
return environment -> getSource(environment).name;
}
@Override
public DataFetcher spacesAvailable() {
return environment -> getSource(environment).spacesAvailable;
}
@Override
public DataFetcher realtime() {
return environment -> getSource(environment).realTimeData;
}
@Override
public DataFetcher lon() {
return environment -> getSource(environment).x;
}
@Override
public DataFetcher lat() {
return environment -> getSource(environment).y;
}
private BikePark getSource(DataFetchingEnvironment environment) {
return environment.getSource();
}
}