Package com.sap.cds.maven.plugin.add
Class TemplateService
java.lang.Object
com.sap.cds.maven.plugin.add.TemplateService
This service creates files and Java classes from templates.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHolds key and value of a template variable. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidcreateClassFromTemplate(File javaSrcFolder, String templatePath, String packageName, String className, boolean overwrite, TemplateService.TemplateVariable... vars) Creates a new Java class source file from a specified resource template.final voidcreateFileFromTemplate(String templatePath, File targetFolder, boolean overwrite, TemplateService.TemplateVariable... variables) Creates a new file from a specified resource template.
-
Constructor Details
-
TemplateService
public TemplateService()
-
-
Method Details
-
createClassFromTemplate
@SafeVarargs public final void createClassFromTemplate(File javaSrcFolder, String templatePath, String packageName, String className, boolean overwrite, TemplateService.TemplateVariable... vars) throws IOException Creates a new Java class source file from a specified resource template.- Parameters:
javaSrcFolder- target folder of the new Java source filetemplatePath- resource path of the template to usepackageName- package of the Java classclassName- name of the Java classoverwrite- usetrueif existing Java class shall be overwrittenvars- additional array of key/value pairs used to replace variables in template- Throws:
IOException- if an I/O error occurred
-
createFileFromTemplate
@SafeVarargs public final void createFileFromTemplate(String templatePath, File targetFolder, boolean overwrite, TemplateService.TemplateVariable... variables) throws IOException Creates a new file from a specified resource template.- Parameters:
templatePath- resource path of the template to usetargetFolder- target folder of the new fileoverwrite- usetrueif existing file shall be overwrittenvariables- additional array of key/value pairs used to replace variables in template- Throws:
IOException- if an I/O error occurred
-