|
|
Re: is there a way to ignore an EPackage during the java code generation ? [message #1759106 is a reply to message #1759053] |
Thu, 06 April 2017 09:31   |
Eclipse User |
|
|
|
Hi Ed, thank you for your answer.
I think I must give you more details on my usecase, because I tried this solution and it didn't work.
I'm doing these things : Papyrus UML Model -> Ecore Model -> java code.
In my Papyrus Model, I have :
- a PrimitiveType mapped on java.lang.Boolean (stereotyped as EDataType)
- a class representing EClass (stereotyped as EClass)
- a class representing EObject (stereotyped as EClass)
Of course these objects are used to types UML Properties
The UML to EMF tool creates an EDatatype and 2 EClasses adressing the real object.
The code generation works fine. (there are no code generated for boolean, EClass and EObject !)
Now, I would like to group these objects in a dedicated Package (or a dedicated model). I do a simple model (in attachment ) to apply your answer.
As the objects in this package are used as type in the second model, the generated code for xxxPackageImpl#init() doesn't compile because we initialize the useless dependency to the package I didn't generate
In attachment a simple example to reproduce my problem in EMF pure.
Thank you for your help.
Of course, I could avoid headache using EBooleanObject, EClass and EObject instead of creating EDatatype and EClass to represent them, but this is the current result of the UMLToEcore transformation so I would like to know if it is possible to not reference a not generated package when it contains only predefined types.
Regards,
/Vincent Lorenzo
Attachment: example.zip
(Size: 24.35KB, Downloaded 123 times)
|
|
|
|
Re: is there a way to ignore an EPackage during the java code generation ? [message #1759156 is a reply to message #1759145] |
Fri, 07 April 2017 02:17  |
Eclipse User |
|
|
|
Hi
Primitives are a source of endless fun. I think that I counted no fewer than 7 different 'Boolean' types between OMG UML via Eclipse UML, Eclipse OCL, Ecore and Java. I suspect that you need to be unifying rather than ignoring.
Since you are doing UML -> Ecore -> Java, you might consider exploiting the OCL->Java code generator so that your UML has OCL 'bodies'. Eclipse UML2, Eclipse OCL supports UML+OCL -> Ecore -> Java.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.25208 seconds