Class TemplatedGenerator
java.lang.Object
org.drools.model.codegen.project.template.TemplatedGenerator
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
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic TemplatedGenerator.Builderbuilder()Optional<com.github.javaparser.ast.CompilationUnit>com.github.javaparser.ast.CompilationUnitcom.github.javaparser.ast.CompilationUnitcompilationUnitOrThrow(String errorMessage) static StringcreateTemplatePath(String basePath, String templateName, String context) Returns the valid template path if exists or nullReturns template path applying naming convention without verifying if exist
-
Field Details
-
DEFAULT_TEMPLATE_BASE_PATH
- See Also:
-
TEMPLATE_FORMAT
- See Also:
-
TEMPLATE_SUFFIX
- See Also:
-
packageName
-
sourceFilePath
-
templateBasePath
-
templateName
-
targetTypeName
-
fallbackContext
-
contextName
-
-
Method Details
-
generatedFilePath
-
templateName
-
targetTypeName
-
compilationUnit
-
compilationUnitOrThrow
-
compilationUnitOrThrow
public com.github.javaparser.ast.CompilationUnit compilationUnitOrThrow() -
templatePath
Returns the valid template path if exists or null- Returns:
-
uncheckedTemplatePath
Returns template path applying naming convention without verifying if exist- Returns:
-
builder
-
createTemplatePath
-