Class TemplatedGenerator


  • public final class TemplatedGenerator
    extends Object
    Utility class to handle multi platform template generation. Template naming convention is the following: templateName + context.name() + "Template.java" e.g.: ApplicationConfigQuarkusTemplate.java PredictionModelsSpringTemplate.java ApplicationJavaTemplate.java By default targetTypeName value is ''templateName'' By default templateBasePath value is ''/class-templates/'' It is possible to specify a fallback context with fallbackContext
    • Method Detail

      • generatedFilePath

        public String generatedFilePath()
      • templateName

        public String templateName()
      • targetTypeName

        public String targetTypeName()
      • compilationUnit

        public Optional<com.github.javaparser.ast.CompilationUnit> compilationUnit()
      • compilationUnitOrThrow

        public com.github.javaparser.ast.CompilationUnit compilationUnitOrThrow​(String errorMessage)
      • compilationUnitOrThrow

        public com.github.javaparser.ast.CompilationUnit compilationUnitOrThrow()
      • templatePath

        public String templatePath()
        Returns the valid template path if exists or null
        Returns:
      • uncheckedTemplatePath

        public String uncheckedTemplatePath()
        Returns template path applying naming convention without verifying if exist
        Returns:
      • createTemplatePath

        public static String createTemplatePath​(String basePath,
                                                String templateName,
                                                String context)