Class GraphQLGenerateCodeTask

java.lang.Object
org.gradle.api.internal.AbstractTask
All Implemented Interfaces:
com.graphql_java_generator.plugin.conf.CommonConfiguration, com.graphql_java_generator.plugin.conf.GenerateClientCodeConfiguration, com.graphql_java_generator.plugin.conf.GenerateCodeCommonConfiguration, com.graphql_java_generator.plugin.conf.GenerateServerCodeConfiguration, com.graphql_java_generator.plugin.conf.GraphQLConfiguration, Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>
Direct Known Subclasses:
GeneratePojoTask

public class GraphQLGenerateCodeTask extends GenerateServerCodeTask implements com.graphql_java_generator.plugin.conf.GraphQLConfiguration

This goal is deprecated. The graphql goal generates the java code from one or more GraphQL schemas. It allows to work in Java with graphQL, in a schema first approach.

It will be maintained in the future 2.x versions. The generateClientCode and generateServerCode should be used instead.

The graphql goal has two main modes:
  • client mode: it does the same jobs as the generateClientCode goal. It generates a class for each query, mutation and subscription type. These classes contain the methods to call the queries, mutations and subscriptions. That is: to execute a query against the GraphQL server, you just have to call one of this method. It also generates the POJOs from the GraphQL schema. The GraphQL response is stored in these POJOs, for an easy and standard use in Java.
  • server mode: it does the same jobs as the generateServerCode goal. It generates the whole heart of the GraphQL server. The developer has only to develop request to the data. That is the main method (in a jar project) or the main server (in a war project), and all the Spring wiring, based on graphql-java-spring, itself being build on top of graphql-java. It also generates the POJOs. An option allows to annotate them with the standard JPA annotations, to make it easy to link with a database. This goal generates the interfaces for the DataFetchersDelegate (often named providers) that the server needs to implement

Note: The attribute have no default values: their default values is read from the GenerateCodeCommonExtension, whose attributes can be either the default value, or a value set in the build script.

  • Constructor Details

    • GraphQLGenerateCodeTask

      @Inject public GraphQLGenerateCodeTask(org.gradle.api.file.ProjectLayout projectLayout)
      Parameters:
      projectLayout - This Gradle service is automatically injected by gradle. It allows to retrieve the project directory, as accessing the Gradle Project is forbidden from a task.
    • GraphQLGenerateCodeTask

      public GraphQLGenerateCodeTask(GraphQLExtension extension, org.gradle.api.file.ProjectLayout projectLayout)
  • Method Details

    • execute

      public void execute()
      Overrides:
      execute in class GenerateServerCodeTask
    • getMode

      @Input public com.graphql_java_generator.plugin.conf.PluginMode getMode()
      Specified by:
      getMode in interface com.graphql_java_generator.plugin.conf.GenerateCodeCommonConfiguration
      Overrides:
      getMode in class GenerateServerCodeTask
    • setMode

      public final void setMode(com.graphql_java_generator.plugin.conf.PluginMode mode)
    • isGenerateDeprecatedRequestResponse

      @Input public final boolean isGenerateDeprecatedRequestResponse()
      Specified by:
      isGenerateDeprecatedRequestResponse in interface com.graphql_java_generator.plugin.conf.GenerateClientCodeConfiguration
    • setGenerateDeprecatedRequestResponse

      public final void setGenerateDeprecatedRequestResponse(boolean generateDeprecatedRequestResponse)
    • isGenerateJacksonAnnotations

      @Internal public boolean isGenerateJacksonAnnotations()
      Specified by:
      isGenerateJacksonAnnotations in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
      Specified by:
      isGenerateJacksonAnnotations in interface com.graphql_java_generator.plugin.conf.GenerateClientCodeConfiguration
      Specified by:
      isGenerateJacksonAnnotations in interface com.graphql_java_generator.plugin.conf.GenerateServerCodeConfiguration
      Specified by:
      isGenerateJacksonAnnotations in interface com.graphql_java_generator.plugin.conf.GraphQLConfiguration
      Overrides:
      isGenerateJacksonAnnotations in class GenerateServerCodeTask
    • getExtension

      protected GraphQLExtension getExtension()
      Overrides:
      getExtension in class GenerateServerCodeTask