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

org.opentripplanner.ext.legacygraphqlapi.datafetchers.LegacyGraphQLTranslatedStringImpl 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 java.util.Map;

public class LegacyGraphQLTranslatedStringImpl
    implements LegacyGraphQLDataFetchers.LegacyGraphQLTranslatedString {

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

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

  private Map.Entry getSource(DataFetchingEnvironment environment) {
    return environment.getSource();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy