Class CommonExtension

java.lang.Object
com.graphql_java_generator.gradleplugin.CommonExtension
All Implemented Interfaces:
com.graphql_java_generator.plugin.conf.CommonConfiguration
Direct Known Subclasses:
GenerateCodeCommonExtension, GenerateGraphQLSchemaExtension

public class CommonExtension extends Object implements com.graphql_java_generator.plugin.conf.CommonConfiguration

This class contain the parameters that are common to all Gradle Extensions for this plugin, that is the parameters that are common to all the tasks of this plugin. The extensions are used here to define the default values for the task parameters

This avoids to redeclare each common parameter in each Extension, including its comment. When a comment is updated, only one update is necessary, instead of updating it in each Extension.

  • Field Details

    • projectLayout

      protected final org.gradle.api.file.ProjectLayout projectLayout
      The layout of the current project. This allowed to create an instance of File from a relative path
  • Constructor Details

    • CommonExtension

      public CommonExtension(org.gradle.api.file.ProjectLayout projectLayout)
  • Method Details

    • getEnumPrefix

      public String getEnumPrefix()
      An optional prefix to add to the classnames of the generated java classes for GraphQL enums. The prefix is added at the beginning of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.)
      Specified by:
      getEnumPrefix in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setEnumPrefix

      public void setEnumPrefix(String enumPrefix)
    • getEnumSuffix

      public String getEnumSuffix()
      An optional suffix to add to the classnames of the generated java classes for GraphQL enums. The suffix is added at the end of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.)
      Specified by:
      getEnumSuffix in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setEnumSuffix

      public void setEnumSuffix(String enumSuffix)
    • isInitialized

      public boolean isInitialized()
    • setInitialized

      public void setInitialized(boolean initialized)
    • getInputPrefix

      public String getInputPrefix()
      An optional prefix to add to the classnames of the generated java classes for GraphQL input objects. The prefix is added at the beginning of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.)
      Specified by:
      getInputPrefix in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setInputPrefix

      public void setInputPrefix(String inputPrefix)
    • getInputSuffix

      public String getInputSuffix()
      An optional suffix to add to the classnames of the generated java classes for GraphQL input objects. The suffix is added at the end of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.)
      Specified by:
      getInputSuffix in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setInputSuffix

      public void setInputSuffix(String inputSuffix)
    • getMaxTokens

      public Integer getMaxTokens()
      Specified by:
      getMaxTokens in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setMaxTokens

      public void setMaxTokens(Integer maxTokens)
    • getProjectBuildDir

      public File getProjectBuildDir()
      Specified by:
      getProjectBuildDir in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • getProjectDir

      public File getProjectDir()
      Specified by:
      getProjectDir in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • getProjectMainSourceFolder

      public File getProjectMainSourceFolder()
      Specified by:
      getProjectMainSourceFolder in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • getSchemaFileFolder

      public File getSchemaFileFolder()
      Specified by:
      getSchemaFileFolder in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • getTargetSchemaSubFolder

      public String getTargetSchemaSubFolder()
      Specified by:
      getTargetSchemaSubFolder in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setTargetSchemaSubFolder

      public void setTargetSchemaSubFolder(String targetSchemaSubFolder)
    • setSchemaFileFolder

      public final void setSchemaFileFolder(String schemaFileFolder)
    • getSchemaFilePattern

      public String getSchemaFilePattern()
      Specified by:
      getSchemaFilePattern in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setSchemaFilePattern

      public final void setSchemaFilePattern(String schemaFilePattern)
    • getTemplates

      public Map<String,String> getTemplates()
      Specified by:
      getTemplates in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setTemplates

      public final void setTemplates(Map<String,String> templates)
    • getTypePrefix

      public String getTypePrefix()
      An optional prefix to add to the classnames of the generated java classes for GraphQL types. The prefix is added at the beginning of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.)
      Specified by:
      getTypePrefix in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setTypePrefix

      public void setTypePrefix(String typePrefix)
    • getTypeSuffix

      public String getTypeSuffix()
      An optional suffix to add to the classnames of the generated java classes for GraphQL types. The suffix is added at the end of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.)
      Specified by:
      getTypeSuffix in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setTypeSuffix

      public void setTypeSuffix(String typeSuffix)
    • getUnionPrefix

      public String getUnionPrefix()
      An optional prefix to add to the classnames of the generated java classes for GraphQL unions. The prefix is added at the beginning of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.)
      Specified by:
      getUnionPrefix in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setUnionPrefix

      public void setUnionPrefix(String unionPrefix)
    • getUnionSuffix

      public String getUnionSuffix()
      An optional suffix to add to the classnames of the generated java classes for GraphQL unions. The suffix is added at the end of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.)
      Specified by:
      getUnionSuffix in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setUnionSuffix

      public void setUnionSuffix(String unionSuffix)
    • getInterfacePrefix

      public String getInterfacePrefix()
      An optional prefix to add to the classnames of the generated java classes for GraphQL interfaces. The prefix is added at the beginning of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.)
      Specified by:
      getInterfacePrefix in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setInterfacePrefix

      public void setInterfacePrefix(String interfacePrefix)
    • getInterfaceSuffix

      public String getInterfaceSuffix()
      An optional suffix to add to the classnames of the generated java classes for GraphQL interfaces. The suffix is added at the end of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.)
      Specified by:
      getInterfaceSuffix in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setInterfaceSuffix

      public void setInterfaceSuffix(String interfaceSuffix)
    • getJsonGraphqlSchemaFilename

      public String getJsonGraphqlSchemaFilename()

      If defined, the plugin loads the GraphQL schema from this json file. This allows to generate the code from the result of a GraphQL introspection query executed against an existing GraphQL server, for instance if you don't have its GraphQL schema file.

      This json file should have been retrieved by the full introspection query. You can find the introspection query from the getIntrospectionQuery of the graphql-js or from this graphql-java class. You then have to run it against the GraphQL server, and store the response into a schema.json file.

      Specified by:
      getJsonGraphqlSchemaFilename in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
      Returns:
    • setJsonGraphqlSchemaFilename

      public void setJsonGraphqlSchemaFilename(String jsonGraphqlSchemaFilename)
    • isAddRelayConnections

      public boolean isAddRelayConnections()
      Specified by:
      isAddRelayConnections in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setAddRelayConnections

      public final void setAddRelayConnections(boolean addRelayConnections)
    • isSkipGenerationIfSchemaHasNotChanged

      @Deprecated public boolean isSkipGenerationIfSchemaHasNotChanged()
      Deprecated.
      Specified by:
      isSkipGenerationIfSchemaHasNotChanged in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setSkipGenerationIfSchemaHasNotChanged

      public final void setSkipGenerationIfSchemaHasNotChanged(boolean skipGenerationIfSchemaHasNotChanged)
    • logConfiguration

      public void logConfiguration()
      Specified by:
      logConfiguration in interface com.graphql_java_generator.plugin.conf.CommonConfiguration