Class GenerateCustomTemplate

java.lang.Object
com.graphql_java_generator.custom_template.GenerateCustomTemplate
All Implemented Interfaces:
Runnable

public class GenerateCustomTemplate extends Object implements Runnable
This class generates a custom template, bases on the `client_query_mutation_type.vm.java` one, to check that custom templates are properly managed, when provided in an external tool. The reason of having this code is to automatically report any change done in the original template into the custom template, to avoid strange errors, like this one:
  • One changes the original template, but forget to report this change into the custom template
  • The generated code doesn't contain the change done in the original template, as it uses the unchanged custom template
This template is tested in the com.graphql_java_generator.customtemplates.ValidateCustomQueryIT of the graphql-maven-plugin-samples-allGraphQLCases-client maven module.
Important note: This class is executed by the exec-maven-plugin of the current maven project. It is not executed in the gradle build. This has this consequences:
  • Any change in this class must be tested by a maven build
  • If any change is done on a template in the plugin-logic module, the Maven build must be executed before the gradle build (this is quite logical and automatic, as this module doesn't exist in the Gradle build: the Gradle build just depends on it)
  • The generated file replaces the previous custom template, in the src\main\resources\templates\resttemplate of this project, and will be available as a standard resource, in git (for instance, for the Gradle build)
Author:
etienne-sf
  • Constructor Details

    • GenerateCustomTemplate

      public GenerateCustomTemplate(Properties projectProperties, Properties systemProperties)
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable