Let's say I have a root concept A that has children of concept B.
I want to generate two Java classes from concept A. Call them Class1 and Class2. In Class1, I want to reduce each B node to a field declaration. In Class2, I want to reduce each B node to a method.
What would be the best way to do this? I've thought of the following:
- Put two root mapping rules and two reduction rules. Each reduction rule checks whether the B node has an ancestor Class1 or Class2. This doesn't seem to work because the B node is always under root A. Even if this works, it's annoying because you have to put a condition everywhere.
- Use two generators: One generator generates Class1 and has a post-processing script that copies out the original A. The other generator then generates Class2. The problem with this is that I lose the ability to run the generator together, possibly because I have mapping labels, etc.
Any suggestions? Thanks!