title: Eclipse EMF - Is there a way to reference a class that is part of a model in a different eclipse plugin without having to store the tostring()?
body: <p>one of the classes in an eclipse plugin model needs to reference another class in a totally different model and plugin.</p>
  
  <p>To do so, I found this <a href="https://www.eclipse.org/forums/index.php/t/131809/" rel="nofollow noreferrer">thread</a>, that suggests using an edatatype and initialize its instance class with the type I need to link to. However, when I tried to link to my class in a different model, it saves the tostring of the class  like in the following example</p>
  
  <pre><code>&lt;tasks description="" id="p1.tsk4" label="1" type="place" time="10"&gt;
    &lt;requiredCapabilityDescriptor&gt;cod.gen.impl.CapabilityDescriptorImpl@78483404 (description: , id: cap2, label: ) (parent: null)&lt;/requiredCapabilityDescriptor&gt;
    &lt;involvedResource&gt;cod.gen.impl.ResourceDescriptorImpl@2839ac4c (description: null, id: null, label: null) (cad: null, material: null, pointySurface: &amp;lt;unset&gt;, sharpEdges: &amp;lt;unset&gt;, thumbnail: null, weight: &amp;lt;unset&gt;) (changeCost: null, generic: &amp;lt;unset&gt;, investCost: null, manufacturer: null)&lt;/involvedResource&gt;
  &lt;/tasks&gt;
  </code></pre>
  
  <p>in this example I am linking to two different external classes CapabilityDescriptorImpl and ResourceDescriptorImpl. As you can see the tostring is stored which is inconvenient in terms of storage and readability, also I am not so sure about the consistency handling in such case (I mean deleting, editing of the referenced instance). According to the thread the tostring is written because I chose the data type to be serializable, I have tried making it non serializable, but that did not work .</p>
  
  <p>So I have tried another approach using an eReference, which minimised the string to save to become </p>
  
  <pre><code>&lt;tasks description="" id="p1.tsk4" label="1" type="place" time="10"&gt;
   &lt;requiredCapabilityDescriptor xsi:type="CoD:CapabilityDescriptor" description="" id="cap2" label=""/&gt;
    &lt;involvedResource xsi:type="CoD:ResourceDescriptor"/&gt;
  &lt;/tasks&gt;
  </code></pre>
  
  <p>which is much better in terms of readability and storage, but I really doubt it is an actual reference it does not contain any thing that can refer to the original instance. Actually I am sure it is not referring to the original object as it does not show any econtainer. And again with the consistency issues.</p>
  
  <p>My last option -that I can think of- is storing the URI of the referenced object but in this case I will have to manage all the consistency issues myself.</p>
  
  <p>So my question is "is there a better way to achieve this external class referencing?"</p>