Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Get annotations from type rather than instance
Get annotations from type rather than instance [message #1849823] Thu, 03 February 2022 15:50 Go to next message
Thomas Barth is currently offline Thomas BarthFriend
Messages: 22
Registered: March 2021
Junior Member
Hi!

Im able to get annotations with
obj.eClass().eAnnotations


However, I need something like
TYPE.eAnnotations


Where TYPE is a an class of my model.

Though TYPE seems to be an EClassImpl it says "Unrecognized variable: (eAnnotations)"

This code is for Acceleo.

[Updated on: Thu, 03 February 2022 15:52]

Report message to a moderator

Re: Get annotations from type rather than instance [message #1849847 is a reply to message #1849823] Fri, 04 February 2022 10:42 Go to previous messageGo to next message
Thomas Barth is currently offline Thomas BarthFriend
Messages: 22
Registered: March 2021
Junior Member
solved.

Simply cast the type to an EClass:
TYPE.oclAsType(ecore::EClass).eAnnotations

[Updated on: Fri, 04 February 2022 10:51]

Report message to a moderator

Re: Get annotations from type rather than instance [message #1849851 is a reply to message #1849847] Fri, 04 February 2022 16:21 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You didn't provide the declaration for TYPE so do not explain why it is not an EModelElement. Most likely its static type is EObject for which EMF removed the helpful, but wrong subtyping of EModelElement perhaps 10 years ago. Once to cast to at least EModelElement, you can access its features.

Regards

Ed Willink



Previous Topic:Can not gen emf-gen from ecore file based on generator (.mwe) of OCL open source
Next Topic:How could I add org.eclipse.ocl as a dependency
Goto Forum:
  


Current Time: Sun May 05 10:45:20 GMT 2024

Powered by FUDForum. Page generated in 0.02733 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top