EAnnotation usage in ecore
Asked Answered
B

1

6

Can anybody explain the usage of EAnnotation in ecore, in terms of its specific fields (i.e., Source, Details, EModel Element, Contents, and References). I looked at its API documentation here, but could not get that much from there.

I am looking for a kind of guideline to explain by example what are the purpose of having annotations with such fields in ecore.

Binette answered 7/5, 2015 at 22:12 Comment(0)
B
6

I asked this question in Eclipse EMF forum and here is an answer. There is also an answer to this question here..

However, I briefly provide an answer to this question: Generally EAnnotations are used in Ecore to encode any kind of information which is not captured by Ecore at first place. For example, they are used in OCLInECore to hold OCL constraints, or in genmodel to store code generation related information and etc.

Source is used to identify the type of annotation. It is usually populated with a URI, to uniquely identify the type of annotation.

Details is a set of (key,value) pairs to hold detailed information regarding this annotation. Actually this is the place annotation data are really stored.

The rest is (quoted from here):

EModel Element , "An EAnnotation is itself an EModelElement, so can also be annotated. It's not often used, but would allow you to build a complex structure.."

Contents EAnnotations can contain arbitrary other objects. This is also not often used, and if you do use it, you can't generate a normal XyzPackageImpl but must ensure that the GenPackage specifies "Initialize by Loading"..."

References. "EAnnotations can refer to arbitrary other objects. This is also not often used, and the same caveat applies and for the contents..."

Binette answered 8/5, 2015 at 5:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.