Search code examples
javaintellij-ideaintellij-plugin

Passing variables to template on class creation inside IntelliJ Plugin


I am creating a Java class inside an IntelliJ plugin using:

new JavaDirectoryServiceImpl().createClass(directory, className, templateName);

I would like to pass parameters that are used within the template. how can i do so?


Solution

  • new JavaDirectoryServiceImpl() is absolutely not intended for use by plugin developers. The correct way to create a file from template with parameters is FileTemplateUtil.createFromTemplate().