Class GraphQLRepositoryInvocationHandler<T>
java.lang.Object
com.graphql_java_generator.client.graphqlrepository.GraphQLRepositoryInvocationHandler<T>
- All Implemented Interfaces:
InvocationHandler
This class is responsible to execute the method call to
GraphQLRepository
.- Author:
- etienne-sf
-
Constructor Summary
ConstructorDescriptionGraphQLRepositoryInvocationHandler
(Class<T> repositoryInterface, org.springframework.context.ApplicationContext ctx) Builds the instance from the given SpringApplicationContext
: it extracts the query, mutation and subscription executors that have been generated from the GraphQL schema. -
Method Summary
-
Constructor Details
-
GraphQLRepositoryInvocationHandler
public GraphQLRepositoryInvocationHandler(Class<T> repositoryInterface, org.springframework.context.ApplicationContext ctx) throws GraphQLRequestPreparationException Builds the instance from the given SpringApplicationContext
: it extracts the query, mutation and subscription executors that have been generated from the GraphQL schema. The mutation and subscription are optional in the GraphQL schema, so these two executors may be null.
Note: when more than one GraphQL schema are used, a GraphQL Repository requests may be relative to only one GraphQL schema. TheGraphQLRepository
s annotation must provide the queryExecutor of this GraphQL schema.
This constructor can only be used on Spring applications, because of its ctx parameter.- Parameters:
repositoryInterface
- TheGraphQLRepository
interface, that thisInvocationHandler
has to manage. It is mandatory.ctx
- The SpringApplicationContext
that allows to retrieve the query, mutation and subscription executors- Throws:
GraphQLRequestPreparationException
-
-
Method Details
-
invoke
Invocation of theInvocationHandler
. This method is called when a method of the T interface is called. This call is delegated to the relevant Query/Mutation/Subscription executor.
- Specified by:
invoke
in interfaceInvocationHandler
- Throws:
Throwable
-