Search in sources :

Example 6 with FieldCoordinates

use of graphql.schema.FieldCoordinates in project graphql-java by graphql-java.

the class ExecutableNormalizedOperationFactory method updateCoordinatedToNFMap.

private void updateCoordinatedToNFMap(ImmutableListMultimap.Builder<FieldCoordinates, ExecutableNormalizedField> coordinatesToNormalizedFields, ExecutableNormalizedField topLevel) {
    for (String objectType : topLevel.getObjectTypeNames()) {
        FieldCoordinates coordinates = FieldCoordinates.coordinates(objectType, topLevel.getFieldName());
        coordinatesToNormalizedFields.put(coordinates, topLevel);
    }
}
Also used : FieldCoordinates(graphql.schema.FieldCoordinates)

Example 7 with FieldCoordinates

use of graphql.schema.FieldCoordinates in project graphql-java by graphql-java.

the class CodeRegistryVisitor method visitGraphQLFieldDefinition.

@Override
public TraversalControl visitGraphQLFieldDefinition(GraphQLFieldDefinition node, TraverserContext<GraphQLSchemaElement> context) {
    GraphQLFieldsContainer parentContainerType = (GraphQLFieldsContainer) context.getParentContext().thisNode();
    DataFetcher<?> dataFetcher = node.getDataFetcher();
    if (dataFetcher != null) {
        FieldCoordinates coordinates = coordinates(parentContainerType, node);
        codeRegistry.dataFetcherIfAbsent(coordinates, dataFetcher);
    }
    return CONTINUE;
}
Also used : FieldCoordinates(graphql.schema.FieldCoordinates) GraphQLFieldsContainer(graphql.schema.GraphQLFieldsContainer)

Example 8 with FieldCoordinates

use of graphql.schema.FieldCoordinates in project spring-graphql by spring-projects.

the class DefaultGraphQlSourceBuilderTests method getDataFetcherForQuery.

private DataFetcher<?> getDataFetcherForQuery(GraphQLSchema schema, String query) {
    FieldCoordinates coordinates = FieldCoordinates.coordinates("Query", query);
    GraphQLFieldDefinition fieldDefinition = schema.getFieldDefinition(coordinates);
    return schema.getCodeRegistry().getDataFetcher(coordinates, fieldDefinition);
}
Also used : GraphQLFieldDefinition(graphql.schema.GraphQLFieldDefinition) FieldCoordinates(graphql.schema.FieldCoordinates)

Aggregations

FieldCoordinates (graphql.schema.FieldCoordinates)8 GraphQLFieldDefinition (graphql.schema.GraphQLFieldDefinition)4 GraphQLObjectType (graphql.schema.GraphQLObjectType)2 GraphQLSchema (graphql.schema.GraphQLSchema)2 ArrayList (java.util.ArrayList)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableListMultimap (com.google.common.collect.ImmutableListMultimap)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Sets (com.google.common.collect.Sets)1 Assert.assertNotNull (graphql.Assert.assertNotNull)1 Assert.assertShouldNeverHappen (graphql.Assert.assertShouldNeverHappen)1 Internal (graphql.Internal)1 Scalars (graphql.Scalars)1 ImmutableKit.map (graphql.collect.ImmutableKit.map)1 ConditionalNodes (graphql.execution.ConditionalNodes)1 MergedField (graphql.execution.MergedField)1 MergedField.newMergedField (graphql.execution.MergedField.newMergedField)1 ValuesResolver (graphql.execution.ValuesResolver)1 Common (graphql.execution.nextgen.Common)1