How can I organize a large number of Stringtemplate files into different folders

StackOverflow https://stackoverflow.com/questions/21808744

  •  12-10-2022
  •  | 
  •  

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 ?

Était-ce utile?

La 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");
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top