Skip to main content


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 KeefeFriend
Messages: 38
Registered: September 2009
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 MerksFriend
Messages: 33113
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();


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:"unique" handling problem
Next Topic:XCore : opposite to several fields
Goto Forum:
  


Current Time: Thu Mar 28 23:44:48 GMT 2024

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

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

Back to the top