|Re: Problem with LazyLinkingResource.getEObject() [message #896429 is a reply to message #895948]
||Wed, 18 July 2012 11:39
| Sebastian Zarnekow
Registered: July 2009
the lazy linker is implemented on top of the EMF proxy mechanism. As
soon as a lazy linking proxy should be resolved, the linking is
triggered for that exact instance. This implies that the number of
proxies in a list matches the number of resolved elements thus only one
element may be returned per proxy. There is basically nothing that one
could do about that besides not using the lazy linking but do eager
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 16.07.12 17:39, schrieb Joel Bobstein:
> Dear XText development team,
> We are experiencing an issue with LazyLinkingResource.getEObject().
> Since ILinkingService.getLinkedObjects() returns a list, we would expect
> several matches to be supported by the linker. And instead of an
> exception, we believe that the linker should report a new diagnostic
> with something like getViolatedBoundConstraintMessage (exactly the same
> way it is handled if there is zero match).
> Furthermore, in the class Linker, it is exactly how it is programmed. So
> we don't understand why it would be different for LazyLinkingResource.
> Maybe we're missing something. Or maybe it's only a mistake. So we
> kindly ask for your feedback.
> Best Regards,
|Re: Problem with LazyLinkingResource.getEObject() [message #898842 is a reply to message #898382]
||Fri, 27 July 2012 22:26
| Benjamin Schwertfeger
Registered: July 2009
I think you have another understanding of getEObject, than EMF Resources. The mothod is called once per fragment(proxy) and have to return the one element which replaces the resolved fragment, if possible. Even if the feature themself is a list, the getEObject is called for each (lazy) proxy in the list independent to the other proxies and returns the element which is referenced by this name. In case of lazy links it is a bit more complex to get the name, because two proxies with the same reference name, have different fragments in this step.
If you want to validate, that elements in lists are unique, you have to do it after resolving all elements.
I do not know, why getLinkedObjects returns a list, but guess, that it was initially ment to return alle possible elements, which was not implemented because they have to be loaded and all but the first will be dropped for lazy links.
I hope I caught your point and clarify a bit,
Powered by FUDForum
. Page generated in 0.02370 seconds