I try to realize an implementation of an existing API with Xcore. In addition to interfaces, this API has also a classic enumeration.
Take this example: Rating.java
package existing.api;
public enum Rating {
A_RATING,
B_RATING,
C_RATING
}
I was hoping to be able to do something like this in Ecore:
package simple.model
interface Rating wraps existing.api.Rating {}
class Book {
String name
Rating rating
}
But this doesn't seem to work. It generates an error in the Switch class.
In my example in: simple.model.util.ModelSwitch.doSwitch(int, EObject):
@Override
protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case ModelPackage.RATING: {
Rating rating = (Rating)theEObject; //compiler Error: Cannot cast from EObject to Rating
T result = caseRating(rating);
if (result == null) result = defaultCase(theEObject);
return result;
}
...
Any Idea what I can do?
Thank you in advance.