Class GraphQLRepositoryInvocationHandler<T>

  • All Implemented Interfaces:
    java.lang.reflect.InvocationHandler

    public class GraphQLRepositoryInvocationHandler<T>
    extends java.lang.Object
    implements java.lang.reflect.InvocationHandler
    This class is responsible to execute the method call to GraphQLRepository.
    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 Spring ApplicationContext: 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.Object invoke​(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
      Invocation of the InvocationHandler.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 - The GraphQLRepository interface, that this InvocationHandler has to manage. It is mandatory.
        ctx - The Spring ApplicationContext that 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 Spring ApplicationContext: 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. The GraphQLRepositorys 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 - The GraphQLRepository interface, that this InvocationHandler has to manage. It is mandatory.
        ctx - The Spring ApplicationContext that 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.Throwable
        Invocation of the InvocationHandler. 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 interface java.lang.reflect.InvocationHandler
        Throws:
        java.lang.Throwable