|
Re: Track EMF Objects created [message #1102176 is a reply to message #1102151] |
Thu, 05 September 2013 13:23 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
John,
Comments below.
On 05/09/2013 2:35 PM, John D wrote:
> Hello,
>
> I have created an eclipse application which uses EMF. An example of my
> use case is as below
>
> I have a model like
> interface Greeter extends EObject{
> int id;
> }
>
> class StandardGreeter extends EObjectImpl implements Greeter {}
>
> class CustomGreeter extends EObjectImpl implements Greeter {
>
> StandardGreeter sGreeter;
>
> }
>
> Based on a particular event from the user, I am supposed to create
> greeters and link them something as below.
>
> createGreeters()
> {
> sGreeter= new StandardGreeter();
> cGreeter= new CustomGreeter();
> cGreeter.setSGreeter(sGreeter);
> }
>
> The createGreeters() method is called many times.
One would expect from the name that it creates new instances each time.
> So my problem is that I do cannot at any point in time if I want all
> the CustomGreeters. or perhaps get greeter with id=10.
That sentence is hard to parse and I don't know how it's related to the
argumentless method you show above.
> Currently I store all greeters in a Hashmap<id,Greeter>. I am sure
> there must be better way to do this.
Nothing you've show hints at how such IDs are used...
>
> Could someone please point me in the right direction to solve this in
> a right way ?
How are these Greeters used? Do you need to serialize them? Do you
have other models that refer to these instances that need to be
serialized and hence need serialized references to these things?
>
>
> Thanks,
> John D
> P.S; This is a continuation from my previous query
> http://www.eclipse.org/forums/index.php/t/518430/
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03101 seconds