/** * 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); }
@Override public void changeNode(T newNode) { assertNotNull(newNode); assertFalse(this.nodeDeleted, "node is deleted"); this.newNode = newNode; }
private MergedField(List<Field> fields) { assertNotEmpty(fields); this.fields = new ArrayList<>(fields); }
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; }
@Override public void deleteNode() { assertNull(this.newNode, "node is already changed"); assertFalse(this.nodeDeleted, "node is already deleted"); this.nodeDeleted = true; }
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; }
/** * @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; }
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(); } }
/** * 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(); }
void setChildrenContexts(Map<String, List<TraverserContext<T>>> children) { assertTrue(this.children == null, "children already set"); this.children = children; }
/** * 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); } }
public GraphQLTypeReference(String name) { assertValidName(name); this.name = name; }
@Override public T thisNode() { assertFalse(this.nodeDeleted, "node is deleted"); if (newNode != null) { return newNode; } return curNode; }
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; }
/** * 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; }
/** * @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; }
/** * 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(); }
StringPathSegment(String value) { assertTrue(value != null && !value.isEmpty(), "empty path component"); this.value = value; }
@Override public void deleteNode() { assertNull(this.newNode, "node is already changed"); assertFalse(this.nodeDeleted, "node is already deleted"); this.nodeDeleted = true; }
public Builder typeResolver(String parentTypeName, TypeResolver typeResolver) { typeResolverMap.put(assertValidName(parentTypeName), typeResolver); return this; }