Class GenerateClientCodeTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
All Implemented Interfaces:
com.graphql_java_generator.plugin.conf.CommonConfiguration, com.graphql_java_generator.plugin.conf.GenerateClientCodeConfiguration, com.graphql_java_generator.plugin.conf.GenerateCodeCommonConfiguration, 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>

public class GenerateClientCodeTask extends GenerateCodeCommonTask implements com.graphql_java_generator.plugin.conf.GenerateClientCodeConfiguration

The generateClientCode Maven goal (and Gradle task) generates the java code from one or more GraphQL schemas. It allows to work in Java with graphQL, in a schema first approach.

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 these methods. 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.

You'll find more info in the tutorials: take a look at the Maven client tutorial or the Gradle client tutorial

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

    • GenerateClientCodeTask

      @Inject public GenerateClientCodeTask(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.
  • Method Details

    • execute

      public void execute() throws IOException
      Throws:
      IOException
    • isGenerateDeprecatedRequestResponse

      @Input public 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
      Overrides:
      isGenerateJacksonAnnotations in class GenerateCodeCommonTask
    • getExtension

      protected GenerateClientCodeExtension getExtension()
      Overrides:
      getExtension in class GenerateCodeCommonTask
    • 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 GenerateCodeCommonTask