Object name instead of eProxyURI [message #1846953] |
Sun, 10 October 2021 06:57  |
Eclipse User |
|
|
|
Hello,
I have two metamodels A and B.
Metamodel A has class A, and one of the attributes is element: EObject.
I have created a model A conforming to metamodel A, and as element I have chosen one of the classes of metamodel B (After I loaded metamodel B as a resource).
Now I am using a Java code to print the name of the EObject in element, but every time I use getElement(), I get the eProxyURI, while I just want the name.
Here is an example. I get this:
[org.eclipse.emf.ecore.impl.EObjectImpl@b62d79 (eProxyURI: ../org.eclipse.example/plugins/test/metamodel/org.eclipse.example.test.building.model/model/building.ecore#//Building)]
While in fact I only want "Building".
Is there any way to achieve that?
Many thanks,
John
|
|
|
|
|
|
|
|
|
Re: Object name instead of eProxyURI [message #1846969 is a reply to message #1846965] |
Mon, 11 October 2021 01:03  |
Eclipse User |
|
|
|
Did you use the debugger to see why this is not automatically resolved? Something is still wrong if you need to do it manually. But without code, one can only guess.
If you used the debugger, you'd see there the name printed is from in the toString method, and you'd use Open Call Hierarchy on the 'name' field to see that there is a getName method on the implementation EClassImpl which you would see implements that same method declared in an inherited interface of EClass.
|
|
|
Powered by
FUDForum. Page generated in 0.03898 seconds