Skip to main content



      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 16:40 Go to next message
Eclipse UserFriend
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 01:49 Go to previous message
Eclipse UserFriend
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: Tue Jul 08 03:48:35 EDT 2025

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

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

Back to the top