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


Java DataFetchingEnvironment.containsArgument方法代码示例

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


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

示例1: get

import graphql.schema.DataFetchingEnvironment; //导入方法依赖的package包/类
@Override
public List<Category> get(DataFetchingEnvironment environment) {
    if (environment.containsArgument("match")) {
        try {
            final Object name = environment.getArgument("match");
            final Query<Category> categoryQuery = new QueryBuilder<>(Category.class)
                    .contains("name", name.toString())
                    .build();
            try (Stream<Category> categoryStream = getDao().find(categoryQuery)) {
                return categoryStream.collect(Collectors.toList());
            }
        } catch (NoSuchFieldException e) {
            throw new UncheckedSQLException("Cant build query", e);
        }
    }
    try (Stream<Category> all = getDao().findAll()) {
        return all.collect(Collectors.toList());
    }
}
 
开发者ID:nwillc,项目名称:mysnipserver,代码行数:20,代码来源:CategoriesQuery.java

示例2: get

import graphql.schema.DataFetchingEnvironment; //导入方法依赖的package包/类
@Override
public Category get(DataFetchingEnvironment environment) {
    final String name = environment.getArgument("name");
    final Category category = new Category(name);
    if (environment.containsArgument("key")) {
        category.setKey(environment.getArgument("key"));
    }
    getDao().save(category);
    return category;
}
 
开发者ID:nwillc,项目名称:mysnipserver,代码行数:11,代码来源:CategorySave.java

示例3: get

import graphql.schema.DataFetchingEnvironment; //导入方法依赖的package包/类
@Override
public Snippet get(DataFetchingEnvironment environment) {
    final Snippet snippet = new Snippet();
    if (environment.containsArgument("key")) {
        snippet.setKey(environment.getArgument("key"));
    }
    snippet.setTitle(environment.getArgument("title"));
    snippet.setCategory(environment.getArgument("category"));
    snippet.setBody(environment.getArgument("body"));
    getDao().save(snippet);
    return snippet;
}
 
开发者ID:nwillc,项目名称:mysnipserver,代码行数:13,代码来源:SnippetSave.java

示例4: getPaginationArguments

import graphql.schema.DataFetchingEnvironment; //导入方法依赖的package包/类
public PaginationArguments getPaginationArguments(DataFetchingEnvironment environment) {
  String cursor = "";
  int count = DEFAULT_COUNT;

  if (environment.containsArgument("cursor") && (environment.getArgument("cursor") instanceof String)) {
    cursor = new String(DECODER.decode((String) environment.getArgument("cursor")), Charsets.UTF_8);
  }

  if (environment.containsArgument("count")) {
    count = environment.getArgument("count");
  }

  ConfiguredFilter filter = null;
  for (Map.Entry<String, CollectionFilter> entry : collectionFilters.entrySet()) {
    if (environment.containsArgument(entry.getKey())) {
      String searchQuery = environment.getArgument(entry.getKey());
      String cursorArg = cursor;
      int countArg = count;
      String dataSetId = ((DatabaseResult) environment.getSource()).getDataSet().getMetadata().getCombinedId();
      String fieldName = environment.getFieldDefinition().getName();

      filter = () -> entry.getValue().query(dataSetId, fieldName, searchQuery, cursorArg, countArg);
      break;
    }
  }

  return PaginationArguments.create(count, cursor, Optional.ofNullable(filter));
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:29,代码来源:PaginationArgumentsHelper.java


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