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

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

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

Assert.assertValidName介绍

[英]Validates that the Lexical token name matches the current spec. currently non null, non empty,
[中]验证词法标记名称是否与当前规范匹配。当前为非null、非空,

代码示例

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

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

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

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

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

/**
 * Creates new field coordinates
 *
 * @param parentType the container of the field
 * @param fieldName  the field name
 *
 * @return new field coordinates represented by the two parameters
 */
public static FieldCoordinates coordinates(String parentType, String fieldName) {
  assertValidName(parentType);
  assertValidName(fieldName);
  return new FieldCoordinates(parentType, fieldName);
}

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

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

/**
   * 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

/**
 * @param name              the name
 * @param description       the description
 * @param value             the value
 * @param deprecationReason the deprecation reasons
 * @param directives        the directives on this type element
 *
 * @deprecated use the {@link #newEnumValueDefinition()}   builder pattern instead, as this constructor will be made private in a future version.
 */
@Internal
@Deprecated
public GraphQLEnumValueDefinition(String name, String description, Object value, String deprecationReason, List<GraphQLDirective> directives) {
  assertValidName(name);
  assertNotNull(directives, "directives cannot be null");
  this.name = name;
  this.description = description;
  this.value = value;
  this.deprecationReason = deprecationReason;
  this.directives = directives;
}

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

/**
 * @param name         the name
 * @param description  the description
 * @param type         the field type
 * @param defaultValue the default value
 * @param directives   the directives on this type element
 * @param definition   the AST definition
 *
 * @deprecated use the {@link #newInputObjectField()} builder pattern instead, as this constructor will be made private in a future version.
 */
@Internal
@Deprecated
public GraphQLInputObjectField(String name, String description, GraphQLInputType type, Object defaultValue, List<GraphQLDirective> directives, InputValueDefinition definition) {
  assertValidName(name);
  assertNotNull(type, "type can't be null");
  assertNotNull(directives, "directives cannot be null");
  this.name = name;
  this.type = type;
  this.defaultValue = defaultValue;
  this.description = description;
  this.directives = directives;
  this.definition = definition;
}

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

/**
 * @param name        the name
 * @param description the description
 * @param coercing    the coercing function
 * @param directives  the directives on this type element
 * @param definition  the AST definition
 *
 * @deprecated use the {@link #newScalar()} builder pattern instead, as this constructor will be made private in a future version.
 */
@Internal
@Deprecated
public GraphQLScalarType(String name, String description, Coercing coercing, List<GraphQLDirective> directives, ScalarTypeDefinition definition) {
  assertValidName(name);
  assertNotNull(coercing, "coercing can't be null");
  assertNotNull(directives, "directives can't be null");
  this.name = name;
  this.description = description;
  this.coercing = coercing;
  this.definition = definition;
  this.directives = directives;
}

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

/**
 * @param name        the name
 * @param description the description
 * @param values      the values
 * @param directives  the directives on this type element
 * @param definition  the AST definition
 *
 * @deprecated use the {@link #newEnum()}  builder pattern instead, as this constructor will be made private in a future version.
 */
@Internal
@Deprecated
public GraphQLEnumType(String name, String description, List<GraphQLEnumValueDefinition> values, List<GraphQLDirective> directives, EnumTypeDefinition definition) {
  assertValidName(name);
  assertNotNull(directives, "directives cannot be null");
  this.name = name;
  this.description = description;
  this.definition = definition;
  this.directives = directives;
  buildMap(sortGraphQLTypes(values));
}

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

/**
 * @param name               the name
 * @param description        the description
 * @param type               the field type
 * @param dataFetcherFactory the field data fetcher factory
 * @param arguments          the field arguments
 * @param deprecationReason  the deprecation reason
 * @param directives         the directives on this type element
 * @param definition         the AST definition
 *
 * @deprecated use the {@link #newFieldDefinition()} builder pattern instead, as this constructor will be made private in a future version.
 */
@Internal
@Deprecated
public GraphQLFieldDefinition(String name, String description, GraphQLOutputType type, DataFetcherFactory dataFetcherFactory, List<GraphQLArgument> arguments, String deprecationReason, List<GraphQLDirective> directives, FieldDefinition definition) {
  assertValidName(name);
  assertNotNull(dataFetcherFactory, "you have to provide a DataFetcher (or DataFetcherFactory)");
  assertNotNull(type, "type can't be null");
  assertNotNull(arguments, "arguments can't be null");
  this.name = name;
  this.description = description;
  this.type = type;
  this.dataFetcherFactory = dataFetcherFactory;
  this.arguments = Collections.unmodifiableList(sortGraphQLTypes(arguments));
  this.directives = directives;
  this.deprecationReason = deprecationReason;
  this.definition = definition;
}

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

/**
 * @param name        the name
 * @param description the description
 * @param fields      the fields
 * @param directives  the directives on this type element
 * @param definition  the AST definition
 *
 * @deprecated use the {@link #newInputObject()} builder pattern instead, as this constructor will be made private in a future version.
 */
@Internal
@Deprecated
public GraphQLInputObjectType(String name, String description, List<GraphQLInputObjectField> fields, List<GraphQLDirective> directives, InputObjectTypeDefinition definition) {
  assertValidName(name);
  assertNotNull(fields, "fields can't be null");
  assertNotNull(directives, "directives cannot be null");
  this.name = name;
  this.description = description;
  this.definition = definition;
  this.directives = directives;
  buildMap(sortGraphQLTypes(fields));
}

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

/**
 * @param name             the name
 * @param description      the description
 * @param fieldDefinitions the fields
 * @param typeResolver     the type resolver function
 * @param directives       the directives on this type element
 * @param definition       the AST definition
 *
 * @deprecated use the {@link #newInterface()} builder pattern instead, as this constructor will be made private in a future version.
 */
@Internal
@Deprecated
public GraphQLInterfaceType(String name, String description, List<GraphQLFieldDefinition> fieldDefinitions, TypeResolver typeResolver, List<GraphQLDirective> directives, InterfaceTypeDefinition definition) {
  assertValidName(name);
  assertNotNull(fieldDefinitions, "fieldDefinitions can't null");
  assertNotNull(directives, "directives cannot be null");
  this.name = name;
  this.description = description;
  buildDefinitionMap(sortGraphQLTypes(fieldDefinitions));
  this.typeResolver = typeResolver;
  this.definition = definition;
  this.directives = directives;
}

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

/**
 * @param name             the name
 * @param description      the description
 * @param fieldDefinitions the fields
 * @param interfaces       the possible interfaces
 * @param directives       the directives on this type element
 * @param definition       the AST definition
 *
 * @deprecated use the {@link #newObject()} builder pattern instead, as this constructor will be made private in a future version.
 */
@Internal
@Deprecated
public GraphQLObjectType(String name, String description, List<GraphQLFieldDefinition> fieldDefinitions,
             List<GraphQLOutputType> interfaces, List<GraphQLDirective> directives, ObjectTypeDefinition definition) {
  assertValidName(name);
  assertNotNull(fieldDefinitions, "fieldDefinitions can't be null");
  assertNotNull(interfaces, "interfaces can't be null");
  this.name = name;
  this.description = description;
  this.interfaces = sortGraphQLTypes(interfaces);
  this.definition = definition;
  this.directives = assertNotNull(directives);
  buildDefinitionMap(sortGraphQLTypes(fieldDefinitions));
}

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

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

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

/**
 * Creates new field coordinates
 *
 * @param parentType the container of the field
 * @param fieldName  the field name
 *
 * @return new field coordinates represented by the two parameters
 */
public static FieldCoordinates coordinates(String parentType, String fieldName) {
  assertValidName(parentType);
  assertValidName(fieldName);
  return new FieldCoordinates(parentType, fieldName);
}

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

相关文章