How to get "Generator output path" in the generator

Hello, community!


I have the following line in the generated concept class:

class $[name]{


String content = new String(Files.readAllBytes(Paths.get("$[Myfile.txt]")));




How can I get "Generator output path" for the module in the property macro $[Myfile.txt]?

Comment actions Permalink


I haven't tried it, but there exists an API that suggests to get the output path: SolutionDescriptor.getOutputPath()

So, if you have the solution that contains the model that is generated, you can ask for its ModuleDescriptor and cast it to a SolutionDescriptor.

Something like:

myModule.getModuleDescriptor() as SolutionDescriptor.getOutputPath();

It is important that you get the original module. In the context of generation, something like "node.model.module" will likely yield "null", since the generator operates on a transient model. In other words, I am not 100% certain where you would use this API in the context of a transformation to reliably receive the output path of your original model.

Comment actions Permalink

Thanks for answer,


Yes, node.model.module - transient module.

Maybe I can create facet and calculate gen paths for every model. How can I pass that paths in the generator and use them? 


Please sign in to leave a comment.