Interface GenerateCodeCommonConfiguration

All Superinterfaces:
CommonConfiguration
All Known Subinterfaces:
GenerateClientCodeConfiguration, GeneratePojoConfiguration, GenerateServerCodeConfiguration, GraphQLConfiguration

public interface GenerateCodeCommonConfiguration extends CommonConfiguration
This class contains all parameters that are common to the generateClientCode, generateServerCode and graphql goals/tasks.
Author:
etienne-sf
  • Field Details

  • Method Details

    • getCustomScalars

      List<CustomScalarDefinition> getCustomScalars()

      This parameter contains the list of custom scalars implementations. One such implementation must be provided for each custom scalar defined in the GraphQL implemented by the project for its GraphQL schema. It's a list, where the key is the scalar name, as defined in the GraphQL schema, and the value is the full class name of the implementation of GraphQLScalarType.

      This parameter is a list of customScalars. For each one, you must define the name, the javaType and exactly one of these fields: graphQLScalarTypeClass, graphQLScalarTypeStaticField or graphQLScalarTypeGetter.

      Here is the detail:

      • graphQLTypeName: The type name, as defined in the GraphQL schema, for instance Date
      • javaType: The full class name for the java type that contains the data for this type, once in the Java code, for instance java.util.Date
      • graphQLScalarTypeClass: The full class name for the GraphQLScalarType that will manage this Custom Scalar. This class must be a subtype of GraphQLScalarType. Bu the constructor of GraphQLScalarType has been deprecated, so you'll find no sample for that in this project
      • graphQLScalarTypeStaticField: The full class name followed by the static field name that contains the GraphQLScalarType that will manage this Custom Scalar. For instance, the graphql-java package provides several custom scalars like graphql.Scalars.GraphQLLong. You can also use the graphql-java-extended-scalars project, that provides other custom scalars like graphql.scalars.ExtendedScalars.NonNegativeInt.
      • graphQLScalarTypeGetter: The full class name followed by the static method name that returns the GraphQLScalarType that will manage this Custom Scalar. For instance: org.mycompany.MyScalars.getGraphQLLong() or com.graphql_java_generator.customscalars.GraphQLScalarTypeDate. This call may contain parameters, provided that this a valid java command.

      Please have a look at the allGraphQLCases (both client and server) samples for more information. The allGraphQLCases client pom is a good sample.

    • getMode

      PluginMode getMode()
      The generation mode: either client or server. Choose client to generate the code which can query a graphql server or server to generate a code for the server side.
      This parameter is mandatory. It forced to PluginMode.client by the generateClientCode goal/task an to PluginMode.server by the generateServerCode goal/task.
    • getPackageName

      String getPackageName()
      The packageName in which the generated classes will be created
    • getQueryMutationExecutionProtocol

      QueryMutationExecutionProtocol getQueryMutationExecutionProtocol()
      The QueryMutationExecutionProtocol to use for GraphQL queries and mutations (not subscriptions). The allowed values are: http and webSocket.
      The default value is http.
    • getSchemaPersonalizationFile

      File getSchemaPersonalizationFile()

      schemaPersonalizationFile is the file name where the GraphQL maven plugin will find personalization that it must apply before generating the code. Since the 2.2 release, it is available for both client and server. Before, it applies to the server mode only.

      This allows to:

      • Add or modify fields
      • Add interface and annotation to classes (GraphQL types, input types, interfaces, unions and enums) or fields.

      See the doc on the project's wiki for more details.

    • getSourceEncoding

      String getSourceEncoding()
      The encoding for the generated source files
    • getSpringAutoConfigurationPackage

      default String getSpringAutoConfigurationPackage()
      Returns the package that contains the Spring Auto Configuration class. This package may not be the package that contains the executor, nor one of its subpackages, so that the configuration class is not read as a standard Spring configuration class.
    • getSpringBeanSuffix

      String getSpringBeanSuffix()
      Retrieves the suffix that will be applied to the name of the Spring Beans that are generated for this schema. It's mandatory if you' using a Spring app and have more than one GraphQL schemas. The default value is an empty String.
    • getTargetClassFolder

      File getTargetClassFolder()
      The folder where the generated classes will be compiled, that is: where the class file are stored after compilation
    • getTargetResourceFolder

      File getTargetResourceFolder()
      The folder where the generated resources will be generated
    • getTargetSourceFolder

      File getTargetSourceFolder()
      The folder where the source code for the generated classes will be generated
    • isCopyRuntimeSources

      boolean isCopyRuntimeSources()

      Flag to enable (or not) the copy of the sources from the graphql-java-runtime library to target source code directory. That is: it allows to control whether the runtime code is embedded in the generated code or not.

      Caution: the default value changed since the 2.0 version. In 1.x version, the default value is true. Since 2.0 version, the default value is false.

      • If copyRuntimeSources=true: the runtime is copied along with the generated code. The project configuration (pom.xml or build.gradle) must contain the com.graphql-java-generator:graphql-java-dependencies dependency, with the same version as the GraphQL plugin
      • If copyRuntimeSources=false: the runtime is NOT copied along with the generated code. The project configuration (pom.xml or build.gradle) must contain the com.graphql-java-generator:graphql-java-runtime dependency, with the same version as the GraphQL plugin
      Returns:
    • isGenerateUtilityClasses

      default boolean isGenerateUtilityClasses()
      Indicates whether the utility classes should be generated. If false, only the POJO are generated, that is: only the Java classes and interfaces that match the GraphQL provided schema. There is no runtime sources for this goal.
      Returns:
      true if all classes should be generated, false if only the POJO classes should be generated
    • isSeparateUtilityClasses

      boolean isSeparateUtilityClasses()

      Indicates whether the utility classes (that is: the classes that are not match an item in the GraphQL schema) are generated in the same package than the classes that matches the GraphQL schema.

      The classes that map the GraphQL schema (type, input type, interfaces, unions...) are generated in the package defined in the packageName plugin parameter, then:

      • If false (default for versions 1.x), the utility classes are generated in the the same package
      • If true (default for version 2.0 and after), the utility classes are generated in the util subpackage of this package
      Returns:
    • isUseJakartaEE9

      boolean isUseJakartaEE9()
    • logConfiguration

      void logConfiguration()
      Logs all the configuration parameters (only when in the debug level)
      Specified by:
      logConfiguration in interface CommonConfiguration
    • logGenerateCodeCommonConfiguration

      default void logGenerateCodeCommonConfiguration()