Package org.allGraphQLCases.server.impl
Class MyQueryTypeController
java.lang.Object
org.allGraphQLCases.server.MyQueryTypeController
org.allGraphQLCases.server.impl.MyQueryTypeController
@Controller
@SchemaMapping(typeName="MyQueryType")
public class MyQueryTypeController
extends MyQueryTypeController
This class is used to check that the overriding of a Spring Controller actually works at runtime, so it must be
checked on client side. To do this, one of the returned strings is changed.
-
Field Summary
Fields inherited from class org.allGraphQLCases.server.MyQueryTypeController
dataFetchersDelegateMyQueryType, graphqlServerUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncheckOverriddenController
(graphql.schema.DataFetchingEnvironment dataFetchingEnvironment) This method loads the data for ${dataFetcher.graphQLType}.checkOverriddenController.Methods inherited from class org.allGraphQLCases.server.MyQueryTypeController
_if, _implements, _import, _instanceof, _int, _interface, _long, _native, _new, _null, _package, _private, _protected, _public, _return, _short, _static, _strictfp, _super, _switch, _synchronized, _this, _throw, _throws, _transient, _try, _void, _volatile, _while, aBreak, allFieldCases, connectionOnHuman, connectionWithoutParameters, directiveOnField, directiveOnQuery, enumWithReservedJavaKeywordAsValues, error, foo140, issue128, issue200, issue53, issue82Float, issue82ID, json, jsons, jsonsWithInput, jsonWithInput, listOfEnumWithReservedJavaKeywordAsValues, object, objects, objectsWithInput, objectWithInput, relay, reservedJavaKeywordAllFieldCases, returnEnum, returnListOfEnums, returnListOfListOfEnums, returnListOfMandatoryEnums, returnMandatoryEnum, returnMandatoryListOfEnums, returnMandatoryListOfMandatoryEnums, testBase64String, unionTest, withEnum, withList, withListOfList, withOneMandatoryParam, withOneMandatoryParamDefaultValue, withOneOptionalParam, withoutParameters, withTwoMandatoryParamDefaultVal
-
Constructor Details
-
MyQueryTypeController
public MyQueryTypeController()
-
-
Method Details
-
checkOverriddenController
@SchemaMapping(field="checkOverriddenController") public String checkOverriddenController(graphql.schema.DataFetchingEnvironment dataFetchingEnvironment) Description copied from class:MyQueryTypeController
This method loads the data for ${dataFetcher.graphQLType}.checkOverriddenController.
For optimization, this method returns a CompletableFuture. This allows to use graphql-java java-dataloader to highly optimize the number of requests to the server.
The principle is this one: The data loader collects all the data to load, avoid to load several times the same data, and allows parallel execution of the queries, if multiple queries are to be run.
You can implements this method like the sample below:@Override public CompletableFuture<List
> friends(DataFetchingEnvironment environment, DataLoader<Long, Member> dataLoader, Human origin) { List<java.lang.Long> friendIds = origin.getFriendIds(); DataLoader<java.lang.Long, CharacterImpl> dataLoader = environment.getDataLoader("Character"); return dataLoader.loadMany(friendIds); } - Overrides:
checkOverriddenController
in classMyQueryTypeController
- Parameters:
dataFetchingEnvironment
- The GraphQLDataFetchingEnvironment
. It gives you access to the full GraphQL context for this DataFetcher
-