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

org.opentripplanner.ext.legacygraphqlapi.datafetchers.LegacyGraphQLBikeRentalStationImpl 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_rental.BikeRentalStation;

public class LegacyGraphQLBikeRentalStationImpl implements LegacyGraphQLDataFetchers.LegacyGraphQLBikeRentalStation {
    @Override
    public DataFetcher id() {
        return environment -> new Relay.ResolvedGlobalId(
                "BikeRentalStation",
                getSource(environment).id
        );
    }

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

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

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

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

    //TODO:
    @Override
    public DataFetcher state() {
        return environment -> null;
    }

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

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

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy