graphql.Assert类的使用及代码示例

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

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

Assert介绍

暂无

代码示例

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

/**
 * The producing code can provide a callback to know when the subscriber attaches
 *
 * @param subscriptionCallback the callback when some ones
 */
public SingleSubscriberPublisher(OnSubscriptionCallback subscriptionCallback) {
  this.subscriptionCallback = assertNotNull(subscriptionCallback);
}

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

@Override
public void changeNode(T newNode) {
  assertNotNull(newNode);
  assertFalse(this.nodeDeleted, "node is deleted");
  this.newNode = newNode;
}

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

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

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

private GraphQLArgument(String name, String description, GraphQLInputType type, Object defaultValue, Object value, InputValueDefinition definition, List<GraphQLDirective> directives) {
  assertValidName(name);
  assertNotNull(type, "type can't be null");
  this.name = name;
  this.description = description;
  this.type = type;
  this.defaultValue = defaultValue;
  this.value = value;
  this.definition = definition;
  this.directives = directives;
}

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

@Override
public void deleteNode() {
  assertNull(this.newNode, "node is already changed");
  assertFalse(this.nodeDeleted, "node is already deleted");
  this.nodeDeleted = true;
}

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

public SimpleListConnection(List<T> data, String prefix) {
  this.data = assertNotNull(data, " data cannot be null");
  assertTrue(prefix != null && !prefix.isEmpty(), "prefix cannot be null or empty");
  this.prefix = prefix;
}

代码示例来源: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: graphql-java/graphql-java

private GraphQLObjectType getRootTypeFromOperation(OperationDefinition operationDefinition) {
  switch (operationDefinition.getOperation()) {
    case MUTATION:
      return assertNotNull(schema.getMutationType());
    case QUERY:
      return assertNotNull(schema.getQueryType());
    case SUBSCRIPTION:
      return assertNotNull(schema.getSubscriptionType());
    default:
      return assertShouldNeverHappen();
  }
}

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

/**
 * Returns a {@link GraphQLScalarType} given scalar defined in IDL
 *
 * @param environment the wiring environment
 *
 * @return a {@link GraphQLScalarType}
 */
default GraphQLScalarType getScalar(ScalarWiringEnvironment environment) {
  return assertShouldNeverHappen();
}

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

void setChildrenContexts(Map<String, List<TraverserContext<T>>> children) {
  assertTrue(this.children == null, "children already set");
  this.children = children;
}

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

/**
   * The exception to the general rule is the system __xxxx Introspection fields which have no parent type and
   * are able to be specified on any type
   *
   * @param fieldName the name of the system field which MUST start with __
   *
   * @return the coordinates
   */
  public static FieldCoordinates systemCoordinates(String fieldName) {
    assertTrue(fieldName.startsWith("__"), "Only __ system fields can be addressed without a parent type");
    assertValidName(fieldName);
    return new FieldCoordinates(null, fieldName);
  }
}

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

public GraphQLTypeReference(String name) {
  assertValidName(name);
  this.name = name;
}

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

@Override
public T thisNode() {
  assertFalse(this.nodeDeleted, "node is deleted");
  if (newNode != null) {
    return newNode;
  }
  return curNode;
}

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

public GraphQLDirective(String name, String description, EnumSet<DirectiveLocation> locations,
            List<GraphQLArgument> arguments, boolean onOperation, boolean onFragment, boolean onField) {
  assertValidName(name);
  assertNotNull(arguments, "arguments can't be null");
  this.name = name;
  this.description = description;
  this.locations = locations;
  this.arguments.addAll(sortGraphQLTypes(arguments));
  this.onOperation = onOperation;
  this.onFragment = onFragment;
  this.onField = onField;
}

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

/**
 * Called to place system data fetchers (eg Introspection fields) into the mix
 *
 * @param coordinates the field coordinates
 * @param dataFetcher the data fetcher code for that field
 *
 * @return this builder
 */
public Builder systemDataFetcher(FieldCoordinates coordinates, DataFetcher<?> dataFetcher) {
  assertNotNull(dataFetcher);
  assertNotNull(coordinates);
  assertTrue(coordinates.getFieldName().startsWith("__"), "Only __ system fields can be used here");
  systemDataFetcherMap.put(coordinates.getFieldName(), DataFetcherFactories.useDataFetcher(dataFetcher));
  return this;
}

代码示例来源: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;
}

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

/**
 * Returns a {@link TypeResolver} given the type union
 *
 * @param environment the union wiring environment
 *
 * @return a {@link TypeResolver}
 */
default TypeResolver getTypeResolver(UnionWiringEnvironment environment) {
  return assertShouldNeverHappen();
}

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

StringPathSegment(String value) {
  assertTrue(value != null && !value.isEmpty(), "empty path component");
  this.value = value;
}

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

@Override
public void deleteNode() {
  assertNull(this.newNode, "node is already changed");
  assertFalse(this.nodeDeleted, "node is already deleted");
  this.nodeDeleted = true;
}

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

public Builder typeResolver(String parentTypeName, TypeResolver typeResolver) {
  typeResolverMap.put(assertValidName(parentTypeName), typeResolver);
  return this;
}

相关文章