QualifiedNameProvider simply using URI, bad / OK? [message #1389097] |
Fri, 27 June 2014 10:33 |
Michael Vorburger Messages: 103 Registered: July 2009 |
Senior Member |
|
|
Hallo,
I have a quick "best practice / your experience" kind of Q:
In some (but not all) of our models, the only thing that is (currently) externally referenced is the name of their root element. In our tool, it so happens, by convention, that the file name of the respective DSL models exactly matches this name of their root element (which is repeated in the text) - like in a Java class/file name, really.
Now we had some issue which someone tracked to a QualifiedNameProvider that didn't work because that root element was an EMF Proxy (I do not have the full details about the problem), and so someone came up with a "creative" solution to instead of something like return qnc.toQualifiedName(model.getName()); just use name = model.eResource().getURI().lastSegment().substring(0, seg.lastIndexOf(".")) ...
I was wondering if others had any thoughts pro/con this - clearly this is not how a QNP would typically be written (and could not if the content of the resource was used to obtain referenceable names), but in this case "it works"... are there any disadvantages we are forgetting about which may make this approach a Very Bad Idea?
PS: And yes, one would want to have a Validation rule checking that the file name (URI) and root element getName() match.
Thanks.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03756 seconds