Is it possible to have an enumeration in a EMF Ecore model implement an interface ? It is possible in Java to have something like : public enum MyEnum implements MyInterface
. I'd like to be able to generate something like this via EMF (btw, It seems by default all enums generated by EMF implement org.eclipse.emf.common.util.Enumerator
).
I can't find a way to have my generated enumeration implement a particular interface. I can't define inheritance relationships with an enumeration in the ecore diagram editor, nor in the ecore model editor. I can add the implements
bit by hand to the enumeration after generating the code, but then it gets overwritten everytime I generate the code again.
Alternatively, is there a way to have the implements
(and only it) not being overwritten by EMF's code generation ?
I know I can modify the @generated
tag in the class javadoc comment to @generatedNOT
so the code generator knows it musn't overwrite the class, but it prevents the class from being updated when I modify the model.
For now what I do is I manually add the implements
each time I modify this enumeration in the model and keep the @generatedNOT
tag the rest of the time. I feel this will get dangerous in a few months when I'll forget about it, or worse, when someone else tries to modify it, even if properly documented.
Somewhat related : EMF Eclipse: enumeration with custom fields (properties)