Hello,
I'm dealing with a situation where my model is run through a customized generator. There's code in the generator that should output a fully qualified name of the type of a method argument. In case the type is EObject (which can be retraced to the superclass of my model's class and which I am setting programmatically), the "fully qualified name I get" is ecore.EObject, which causes a compiling error. How can I get to org.eclipse.emf.ecore EObject?
Here's the code in question:
Me setting the supertype manually:
ecClass.getESuperTypes().add(EcorePackage.Literals.EOBJECT);
Eventually the class from is processed here:
for (EClass ecls : allClasses) {
out.println("public T case" + ecls.getName() + "(" + fullyQualifiedName(ecls) + " o) {");
...
private String fullyQualifiedName(EPackage pkg) {
return pkg.getESuperPackage() == null ? pkg.getName() : fullyQualifiedName(pkg.getESuperPackage()) + "." + pkg.getName();
}
private String fullyQualifiedName(EClassifier cls) {
return fullyQualifiedName(cls.getEPackage()) + "." + cls.getName();
}
resulting code:
public T caseEObject(ecore.EObject o) {