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

org.opentripplanner.ext.legacygraphqlapi.datafetchers.LegacyGraphQLBookingInfoImpl 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.model.BookingInfo;
import org.opentripplanner.model.BookingTime;
import org.opentripplanner.model.ContactInfo;

public class LegacyGraphQLBookingInfoImpl implements LegacyGraphQLDataFetchers.LegacyGraphQLBookingInfo {
    @Override
    public DataFetcher contactInfo() {
        return environment -> getSource(environment).getContactInfo();
    }

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

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

    @Override
    public DataFetcher minimumBookingNoticeSeconds() {
        return environment -> getSource(environment).getMinimumBookingNotice().toSeconds();
    }

    @Override
    public DataFetcher maximumBookingNoticeSeconds() {
        return environment -> getSource(environment).getMaximumBookingNotice().toSeconds();
    }

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy