graphql.Assert.assertNotEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(251)

本文整理了Java中graphql.Assert.assertNotEmpty()方法的一些代码示例,展示了Assert.assertNotEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.assertNotEmpty()方法的具体详情如下:
包路径:graphql.Assert
类名称:Assert
方法名:assertNotEmpty

Assert.assertNotEmpty介绍

暂无

代码示例

代码示例来源:origin: graphql-java/graphql-java

private MergedField(List<Field> fields) {
  assertNotEmpty(fields);
  this.fields = new ArrayList<>(fields);
}

代码示例来源:origin: graphql-java/graphql-java

private CompletableFuture<NodeMultiZipper<ExecutionResultNode>> resolveNodes(ExecutionContext executionContext, List<NodeMultiZipper<ExecutionResultNode>> unresolvedNodes) {
  assertNotEmpty(unresolvedNodes, "unresolvedNodes can't be empty");
  ExecutionResultNode commonRoot = unresolvedNodes.get(0).getCommonRoot();
  CompletableFuture<List<List<NodeZipper<ExecutionResultNode>>>> listListCF = Async.flatMap(unresolvedNodes,
      executionResultMultiZipper -> fetchAndAnalyze(executionContext, executionResultMultiZipper.getZippers()));
  return flatList(listListCF).thenApply(zippers -> new NodeMultiZipper<ExecutionResultNode>(commonRoot, zippers, RESULT_NODE_ADAPTER));
}

代码示例来源:origin: graphql-java/graphql-java

private NodeZipper<T> moveUp(T parent, List<NodeZipper<T>> sameParent) {
  assertNotEmpty(sameParent, "expected at least one zipper");
  Map<String, List<T>> childrenMap = nodeAdapter.getNamedChildren(parent);
  for (NodeZipper<T> zipper : sameParent) {
    NodeLocation location = zipper.getBreadcrumbs().get(0).getLocation();
    childrenMap.computeIfAbsent(location.getName(), (key) -> new ArrayList<>());
    List<T> childrenList = childrenMap.get(location.getName());
    if (childrenList.size() > location.getIndex()) {
      childrenList.set(location.getIndex(), zipper.getCurNode());
    } else {
      childrenList.add(zipper.getCurNode());
    }
  }
  T newNode = nodeAdapter.withNewChildren(parent, childrenMap);
  List<Breadcrumb<T>> newBreadcrumbs = sameParent.get(0).getBreadcrumbs().subList(1, sameParent.get(0).getBreadcrumbs().size());
  return new NodeZipper<>(newNode, newBreadcrumbs, this.nodeAdapter);
}

代码示例来源:origin: graphql-java/graphql-java

/**
 * @param name         the name
 * @param description  the description
 * @param types        the possible types
 * @param typeResolver the type resolver function
 * @param directives   the directives on this type element
 * @param definition   the AST definition
 *
 * @deprecated use the {@link #newUnionType()} builder pattern instead, as this constructor will be made private in a future version.
 */
@Internal
@Deprecated
public GraphQLUnionType(String name, String description, List<GraphQLOutputType> types, TypeResolver typeResolver, List<GraphQLDirective> directives, UnionTypeDefinition definition) {
  assertValidName(name);
  assertNotNull(types, "types can't be null");
  assertNotEmpty(types, "A Union type must define one or more member types.");
  assertNotNull(directives, "directives cannot be null");
  this.name = name;
  this.description = description;
  this.types = sortGraphQLTypes(types);
  this.typeResolver = typeResolver;
  this.definition = definition;
  this.directives = directives;
}

代码示例来源:origin: com.graphql-java/graphql-java

private MergedField(List<Field> fields) {
  assertNotEmpty(fields);
  this.fields = new ArrayList<>(fields);
}

代码示例来源:origin: com.graphql-java/graphql-java

private CompletableFuture<NodeMultiZipper<ExecutionResultNode>> resolveNodes(ExecutionContext executionContext, List<NodeMultiZipper<ExecutionResultNode>> unresolvedNodes) {
  assertNotEmpty(unresolvedNodes, "unresolvedNodes can't be empty");
  ExecutionResultNode commonRoot = unresolvedNodes.get(0).getCommonRoot();
  CompletableFuture<List<List<NodeZipper<ExecutionResultNode>>>> listListCF = Async.flatMap(unresolvedNodes,
      executionResultMultiZipper -> fetchAndAnalyze(executionContext, executionResultMultiZipper.getZippers()));
  return flatList(listListCF).thenApply(zippers -> new NodeMultiZipper<ExecutionResultNode>(commonRoot, zippers, RESULT_NODE_ADAPTER));
}

代码示例来源:origin: com.graphql-java/graphql-java

private NodeZipper<T> moveUp(T parent, List<NodeZipper<T>> sameParent) {
  assertNotEmpty(sameParent, "expected at least one zipper");
  Map<String, List<T>> childrenMap = nodeAdapter.getNamedChildren(parent);
  for (NodeZipper<T> zipper : sameParent) {
    NodeLocation location = zipper.getBreadcrumbs().get(0).getLocation();
    childrenMap.computeIfAbsent(location.getName(), (key) -> new ArrayList<>());
    List<T> childrenList = childrenMap.get(location.getName());
    if (childrenList.size() > location.getIndex()) {
      childrenList.set(location.getIndex(), zipper.getCurNode());
    } else {
      childrenList.add(zipper.getCurNode());
    }
  }
  T newNode = nodeAdapter.withNewChildren(parent, childrenMap);
  List<Breadcrumb<T>> newBreadcrumbs = sameParent.get(0).getBreadcrumbs().subList(1, sameParent.get(0).getBreadcrumbs().size());
  return new NodeZipper<>(newNode, newBreadcrumbs, this.nodeAdapter);
}

代码示例来源:origin: com.graphql-java/graphql-java

/**
 * @param name         the name
 * @param description  the description
 * @param types        the possible types
 * @param typeResolver the type resolver function
 * @param directives   the directives on this type element
 * @param definition   the AST definition
 *
 * @deprecated use the {@link #newUnionType()} builder pattern instead, as this constructor will be made private in a future version.
 */
@Internal
@Deprecated
public GraphQLUnionType(String name, String description, List<GraphQLOutputType> types, TypeResolver typeResolver, List<GraphQLDirective> directives, UnionTypeDefinition definition) {
  assertValidName(name);
  assertNotNull(types, "types can't be null");
  assertNotEmpty(types, "A Union type must define one or more member types.");
  assertNotNull(directives, "directives cannot be null");
  this.name = name;
  this.description = description;
  this.types = sortGraphQLTypes(types);
  this.typeResolver = typeResolver;
  this.definition = definition;
  this.directives = directives;
}

相关文章