Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Track EMF Objects created
Track EMF Objects created [message #1102151] Thu, 05 September 2013 12:35 Go to next message
John D is currently offline John DFriend
Messages: 6
Registered: August 2013
Junior Member
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. 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.Currently I store all greeters in a Hashmap<id,Greeter>. I am sure there must be better way to do this.

Could someone please point me in the right direction to solve this in a right way ?


Thanks,
John D
P.S; This is a continuation from my previous query http://www.eclipse.org/forums/index.php/t/518430/
Re: Track EMF Objects created [message #1102176 is a reply to message #1102151] Thu, 05 September 2013 13:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
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/
Previous Topic:(De)serialize EObjectContainmentEList?
Next Topic:[cdo] trying to run cdo with hibernate as back end
Goto Forum:
  


Current Time: Fri Apr 26 14:22:34 GMT 2024

Powered by FUDForum. Page generated in 0.03101 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top