Dynamic Class Import in Generator


I am looking for a way to do the following:

The user can create an Object of Concept 'A'. 'A' contains a path to production code. This can be an expression which can potentially be everything - even if it's not returning anything.

I need to extract the class from this 'path to production code'. Just like a dynamic type system language.

So my question is: How to achieve this and how to add these 'extracted classes' into the imports, so that the model contains it and it's generated into the java file?


Can you provide an example or a screenshot of what you're doing? Your question is difficult to understand.


Instead of Writing :

MyClass<OtherClass> variable = obj.getTheVariable()

I want the user to be able to skip the definition of the Template Class:

MyClass variable = obj.getTheVariable()

The Generator can extract the Variable-Type and insert it into the the BaseLanguage's statement. That's no Problem.
But now i need to add this class (OtherClass) into the import of the generated Java file.

How to achieve this import adding?


BaseLanguage's TextGen should add imports for referenced classes automatically. Is it not working for you? What errors/warnings are you getting from the generator?


Please sign in to leave a comment.