Question

In my project, I am using StringTemplate files to generate java code extensively. I am keeping all StringTemplate files in one folder. Now, I want to group StringTemplate files according to their category into different folders. I am using the following way to get instance of String template file.

StringTemplate templateOfSensorDriver = group.getInstanceOf("sensordriver");
// In this code, I am getting instance of sensordriver.st file 
  using getInstanceOf() method.

Can you please suggest me how can I give path of specific folder using getInstaceOf() method ?

Was it helpful?

Solution

Assuming you are using StringTemplate 4, you can qualify your template names. The STGroupDir group will change the path to folders.

group.getInstanceOf("path/to/sensordriver");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top