Class GraphQLRepositoryInvocationHandler<T>
- java.lang.Object
-
- com.graphql_java_generator.client.graphqlrepository.GraphQLRepositoryInvocationHandler<T>
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
public class GraphQLRepositoryInvocationHandler<T> extends java.lang.Object implements java.lang.reflect.InvocationHandlerThis class is responsible to execute the method call toGraphQLRepository.- Author:
- etienne-sf
-
-
Constructor Summary
Constructors Constructor Description GraphQLRepositoryInvocationHandler(java.lang.Class<T> repositoryInterface, GraphQLQueryExecutor queryExecutor, GraphQLMutationExecutor mutationExecutor, GraphQLSubscriptionExecutor subscriptionExecutor)This constructor builds the instance from the given Spring ApplicationContext provides the query, mutation and subscription that have been defined in the GraphQL schema.GraphQLRepositoryInvocationHandler(java.lang.Class<T> repositoryInterface, org.springframework.context.ApplicationContext ctx)This constructor 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)Invocation of theInvocationHandler.
-
-
-
Constructor Detail
-
GraphQLRepositoryInvocationHandler
public GraphQLRepositoryInvocationHandler(java.lang.Class<T> repositoryInterface, GraphQLQueryExecutor queryExecutor, GraphQLMutationExecutor mutationExecutor, GraphQLSubscriptionExecutor subscriptionExecutor) throws GraphQLRequestPreparationException
This constructor builds the instance from the given Spring ApplicationContext provides the query, mutation and subscription that have been defined in the GraphQL schema. The mutation and subscription are optional in the GraphQL schema, so these two executors may be null.- Parameters:
repositoryInterface- TheGraphQLRepositoryinterface, that thisInvocationHandlerhas to manage. It is mandatory.ctx- The SpringApplicationContextthat allows to retrieve the query, mutation and subscription executors- Throws:
GraphQLRequestPreparationException
-
GraphQLRepositoryInvocationHandler
public GraphQLRepositoryInvocationHandler(java.lang.Class<T> repositoryInterface, org.springframework.context.ApplicationContext ctx) throws GraphQLRequestPreparationException
This constructor 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. TheGraphQLRepositorys 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- TheGraphQLRepositoryinterface, that thisInvocationHandlerhas to manage. It is mandatory.ctx- The SpringApplicationContextthat allows to retrieve the query, mutation and subscription executors- Throws:
GraphQLRequestPreparationException
-
-
Method Detail
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.ThrowableInvocation 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:
invokein interfacejava.lang.reflect.InvocationHandler- Throws:
java.lang.Throwable
-
-