当前位置: 首页>>代码示例>>Java>>正文


Java DataFetchingEnvironment.getParentType方法代码示例

本文整理汇总了Java中graphql.schema.DataFetchingEnvironment.getParentType方法的典型用法代码示例。如果您正苦于以下问题:Java DataFetchingEnvironment.getParentType方法的具体用法?Java DataFetchingEnvironment.getParentType怎么用?Java DataFetchingEnvironment.getParentType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在graphql.schema.DataFetchingEnvironment的用法示例。


在下文中一共展示了DataFetchingEnvironment.getParentType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUnbatched

import graphql.schema.DataFetchingEnvironment; //导入方法依赖的package包/类
public Object getUnbatched(DataFetchingEnvironment env) {
    if ( ! isBatched ) return fetcher.get(env);
    DataFetchingEnvironment envCopy =
        new DataFetchingEnvironmentImpl(
            Collections.singletonList(env.getSource()),
            env.getArguments(),
            env.getContext(),
            env.getFields(),
            env.getFieldType(),
            env.getParentType(),
            env.getGraphQLSchema(),
                env.getFragmentsByName(),
                env.getExecutionId(),
                env.getSelectionSet());
    Object result = fetcher.get(envCopy);
    if ( !(result instanceof List) || ((List)result).size() != 1 ) {
        throw new IllegalStateException("Batched fetcher "+fetcher+" expected to return list of 1");
    }
    return ((List)result).get(0);
}
 
开发者ID:Distelli,项目名称:graphql-apigen,代码行数:21,代码来源:ResolverDataFetcher.java

示例2: ResolutionEnvironment

import graphql.schema.DataFetchingEnvironment; //导入方法依赖的package包/类
public ResolutionEnvironment(DataFetchingEnvironment env, ValueMapper valueMapper, GlobalEnvironment globalEnvironment) {
    
    this.context = env.getSource();
    this.rootContext = env.getContext();
    this.valueMapper = valueMapper;
    this.globalEnvironment = globalEnvironment;
    this.fields = env.getFields();
    this.fieldType = env.getFieldType();
    this.parentType = env.getParentType();
    this.graphQLSchema = env.getGraphQLSchema();
    this.dataFetchingEnvironment = env;
}
 
开发者ID:leangen,项目名称:graphql-spqr,代码行数:13,代码来源:ResolutionEnvironment.java

示例3: Environment

import graphql.schema.DataFetchingEnvironment; //导入方法依赖的package包/类
public Environment(DataFetchingEnvironment environment) {
    Map<String, Object> args = environment.getArguments();

    requestScope = (GraphQLRequestScope) environment.getContext();

    filters = Optional.ofNullable((String) args.get(ModelBuilder.ARGUMENT_FILTER));
    offset = Optional.ofNullable((String) args.get(ModelBuilder.ARGUMENT_AFTER));
    first = Optional.ofNullable((String) args.get(ModelBuilder.ARGUMENT_FIRST));
    sort = Optional.ofNullable((String) args.get(ModelBuilder.ARGUMENT_SORT));

    parentType = environment.getParentType();

    outputType = environment.getFieldType();

    rawSource = environment.getSource();
    container = isRoot() ? new RootContainer() : (GraphQLContainer) rawSource;

    if (rawSource instanceof PersistentResourceContainer) {
        parentResource = ((PersistentResourceContainer) rawSource).getPersistentResource();
    } else {
        parentResource = null;
    }

    field = environment.getFields().get(0);

    this.ids = Optional.ofNullable((List<String>) args.get(ModelBuilder.ARGUMENT_IDS));

    List<Map<String, Object>> data;
    if (args.get(ModelBuilder.ARGUMENT_DATA) instanceof Map) {
        data = Arrays.asList((Map<String, Object>) args.get(ModelBuilder.ARGUMENT_DATA));
    } else {
        data = (List<Map<String, Object>>) args.get(ModelBuilder.ARGUMENT_DATA);
    }
    this.data = Optional.ofNullable(data);
}
 
开发者ID:yahoo,项目名称:elide,代码行数:36,代码来源:Environment.java


注:本文中的graphql.schema.DataFetchingEnvironment.getParentType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。