Using interface, which is defined in generator model, in solution code.

Hello,

in generator model I have defined interface, which is generated by condition root rules. I need use this interface in some other concepts. So far so good. But I need to use that interface in solution code, too. And thats the problem, because I do not find way how to do it.

If I imports generator model to the solution model, I can use that interface in IDE, but after building it throws errors. Because there is linked interface in generator package and that is wrong. I need linking to solution package, where is the interface correctly generated and compiled.

Thanks for any response,
Tom
2 comments
Hi Tom,

ok - you have to import the generated java code as stub in your solution.
(1) You generate some code - also your interface
(2) You import the generated code with stub ..
(3) You reference to the stub. However - if you regenerate the interface .. you will run into problems ..

Dan
0
Thanks Dan for advice. I finally have done it differently:
(1) I have created concept MyInterface as extending Interface
(2) MyInterface has constructor behavior, which fill up needed methods, interface's name etc.
(3) editor aspect of MyInterface is done as immutable
(3) there is template declaration in generator model, with same methods and interface's name as are created by behavior in generator model

Thanks that
(1) generator can use that interface by referencing to template declaration
(2) user can use interface after instantiation of concept
(3) after generation are links correct

The solution is little bit complex and have interface's definition on 2 places (generator and behavior). But user do not have to copy any file to his solution or import any stub.

I hope it helps someone.

Tom
0

Please sign in to leave a comment.