简体   繁体   中英

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

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 ?

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");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM