Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to make a class a singleton(Implement the singleton pattern)
How to make a class a singleton [message #1085364] Mon, 12 August 2013 20:40 Go to next message
Ken Keefe is currently offline Ken Keefe
Messages: 12
Registered: September 2009
Junior Member
I have a class I've described in ECore that I'd like to be a singleton class. Is this possible in ECore/EMF?

So, instead of executing:

ProjectsFactory.eINSTANCE.createWorkspaceManager();

I would execute:

ProjectsFactory.eINSTANCE.getWorkspaceManager();

or even better:

WorkspaceManager.getWorkspaceManager();
Re: How to make a class a singleton [message #1085607 is a reply to message #1085364] Tue, 13 August 2013 05:49 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26149
Registered: July 2009
Senior Member
Ken,

Certainly you can add such things by hand, but there's no way to
generate it. It's always possible to create more than one instance of
any non-abstract EClass...


On 12/08/2013 10:40 PM, Ken Mising name wrote:
> I have a class I've described in ECore that I'd like to be a singleton
> class. Is this possible in ECore/EMF?
> So, instead of executing:
>
> ProjectsFactory.eINSTANCE.createWorkspaceManager();
>
> I would execute:
>
> ProjectsFactory.eINSTANCE.getWorkspaceManager();
>
> or even better:
>
> WorkspaceManager.getWorkspaceManager();
Previous Topic:"unique" handling problem
Next Topic:XCore : opposite to several fields
Goto Forum:
  


Current Time: Thu Oct 30 13:08:07 GMT 2014

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

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