org.opentripplanner.ext.legacygraphqlapi.datafetchers.LegacyGraphQLBikeParkImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
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.vehicle_parking.VehicleParking;
public class LegacyGraphQLBikeParkImpl implements LegacyGraphQLDataFetchers.LegacyGraphQLBikePark {
@Override
public DataFetcher bikeParkId() {
return environment -> getSource(environment).getId().getId();
}
@Override
public DataFetcher id() {
return environment ->
new Relay.ResolvedGlobalId("BikePark", getSource(environment).getId().toString());
}
@Override
public DataFetcher lat() {
return environment -> getSource(environment).getCoordinate().latitude();
}
@Override
public DataFetcher lon() {
return environment -> getSource(environment).getCoordinate().longitude();
}
@Override
public DataFetcher name() {
return environment -> getSource(environment).getName().toString();
}
// TODO
@Override
public DataFetcher> openingHours() {
return environment -> null;
}
@Override
public DataFetcher realtime() {
return environment -> getSource(environment).hasRealTimeData();
}
@Override
public DataFetcher spacesAvailable() {
return environment -> {
var availability = getSource(environment).getAvailability();
if (availability == null) {
return null;
}
return availability.getBicycleSpaces();
};
}
@Override
public DataFetcher> tags() {
return environment -> getSource(environment).getTags();
}
private VehicleParking getSource(DataFetchingEnvironment environment) {
return environment.getSource();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy