Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I generate a single file, which is constantly appended to (e.g. all classnames of a model)?

appended constantly file model
0
Posted

How can I generate a single file, which is constantly appended to (e.g. all classnames of a model)?

0

You cannot specify the same filename in multiple templates – the second template applied would merge the results with the existing file, which is most likely not what you want. You can generate information based on the complete model very easily though using the postProcessModel hook. Here is the simple example that list all classes in a model. First, you define two lists – CLASSES and INTERFACES – that you append to when the model is processed: <%! public String[] getTemplates(MBase element) { String name = getMetaModel().getName(element); if (getMetaModel().isClass(element)) { addToPart("CLASSES",element); } else if (getMetaModel().isInterface(element)) { addToPart("INTERFACES",element); } %> <%! public String[] getPostprocessTemplates() { return new String[] {"class_list.jsp" }; } %> As you have registered class_list.jsp as the template to be executed during post-processing, you need to define it: <%@ page import="java.util.Collection, ru.novsoft.uml.MBase, com.innoq.generator.Strin

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.