|
Re: How to disambiguate com.a.foo.FooPackageImpl and com.b.foo.FooPackageImp [message #417451 is a reply to message #417449] |
Mon, 10 March 2008 23:08 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------050600060306050307040402
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Jason,
Comments below.
jason henriksen wrote:
>
> Hi All,
>
> I've got multiple teams using EMF. One team has built com.a.model
> which generats com.a.model.ModelPackageImpl.
It sounds like you have more developers than the EMF team does. :-P
>
> Another team generated com.b.model and thus com.b.model.ModelPackageImpl.
Using unique names like AModelPackage and BModelPackage will make it
easier to use them together at the same time.
>
> A third team tries to write an object using both of these other model
> definitions, but the generated code ends up with something like this:
>
> import com.a.model.ModelPackageImpl;
> import com.b.model.ModelPackageImpl; <-- ERROR: duplicate import.
How surprising is that? :-P Actually, EMF shouldn't generate code
like this directly. It will try to import each one and when it hits a
conflict that one will be fully qualified. But it's not currently smart
enough to look at what's been imported in the target file into account,
see 182692 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=182692>.
>
> I could use fully qualified class names, but that's really ugly. I'm
> hoping to find a way to generate code that doesn't require me to make
> the last word of my package name unique.
Ensuring that class names are unique seems best. I can't think of a way
to avoid that. You should have a better model prefix than "Model".
>
> Can I force the PackageImpl names to use the whole package structure?
> (maybe even the whole package structure except the com part)
It's the GenPackage's Prefix that needs to be reasonably unique.
>
> It seems like this would be easy to do, but my googling around didn't
> find it. Any help is much appreciated!
Likely using GenPrefix.Prefix set to AModel and BModel would be much better.
>
> Jason Henriksen
>
--------------050600060306050307040402
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Jason,<br>
<br>
Comments below.<br>
<br>
jason henriksen wrote:
<blockquote cite="mid:fr4dfa$9tk$1@build.eclipse.org" type="cite"><br>
Hi All,
<br>
<br>
I've got multiple teams using EMF. One team has built com.a.model
which generats com.a.model.ModelPackageImpl.
<br>
</blockquote>
It sounds like you have more developers than the EMF team does. :-P<br>
<blockquote cite="mid:fr4dfa$9tk$1@build.eclipse.org" type="cite"><br>
Another team generated com.b.model and thus
com.b.model.ModelPackageImpl.
<br>
</blockquote>
Using unique names like AModelPackage and BModelPackage will make it
easier to use them together at the same time.<br>
<blockquote cite="mid:fr4dfa$9tk$1@build.eclipse.org" type="cite"><br>
A third team tries to write an object using both of these other model
definitions, but the generated code ends up with something like this:
<br>
<br>
import com.a.model.ModelPackageImpl;
<br>
import com.b.model.ModelPackageImpl; <-- ERROR: duplicate import.
<br>
</blockquote>
How surprising is that? :-P Actually, EMF shouldn't generate code
like this directly. It will try to import each one and when it hits a
conflict that one will be fully qualified. But it's not currently
smart enough to look at what's been imported in the target file into
account, see <a name="b182692"
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=182692">182692</a>.<br>
<blockquote cite="mid:fr4dfa$9tk$1@build.eclipse.org" type="cite"><br>
I could use fully qualified class names, but that's really ugly. I'm
hoping to find a way to generate code that doesn't require me to make
the last word of my package name unique.
<br>
</blockquote>
Ensuring that class names are unique seems best. I can't think of a
way to avoid that. You should have a better model prefix than "Model".<br>
<blockquote cite="mid:fr4dfa$9tk$1@build.eclipse.org" type="cite"><br>
Can I force the PackageImpl names to use the whole package structure?
(maybe even the whole package structure except the com part)
<br>
</blockquote>
It's the GenPackage's Prefix that needs to be reasonably unique.<br>
<blockquote cite="mid:fr4dfa$9tk$1@build.eclipse.org" type="cite"><br>
It seems like this would be easy to do, but my googling around didn't
find it. Any help is much appreciated!
<br>
</blockquote>
Likely using GenPrefix.Prefix set to AModel and BModel would be much
better.<br>
<blockquote cite="mid:fr4dfa$9tk$1@build.eclipse.org" type="cite"><br>
Jason Henriksen
<br>
<br>
</blockquote>
<br>
</body>
</html>
--------------050600060306050307040402--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02654 seconds