Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Dependency injection in objects instantiated in custom code
Dependency injection in objects instantiated in custom code [message #1060866] Tue, 28 May 2013 18:28 Go to next message
Erick Fonseca is currently offline Erick FonsecaFriend
Messages: 68
Registered: December 2011
Member
My question is mostly related to Google Guice. In my GlobalScopeProvider, I need to instantiate an XtextResource.

myResource = new XtextResource(myUri);


Is there a way I can take advantage of all bindings defined in my DSL module in order to populate XtextResource fields?
Re: Dependency injection in objects instantiated in custom code [message #1060871 is a reply to message #1060866] Tue, 28 May 2013 19:02 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

the whole point of dependency injection is not to use constructors... How about injecting IResourceFactory (bound in DefaultRuntimeModule)? Going back one step, I'd ask, why do you need a new XtextResource in the GlobalScopeProvider - what do you want to achieve?


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: Dependency injection in objects instantiated in custom code [message #1060874 is a reply to message #1060871] Tue, 28 May 2013 19:15 Go to previous message
Erick Fonseca is currently offline Erick FonsecaFriend
Messages: 68
Registered: December 2011
Member
I'm new to dependency injection, still getting the hang of it. I will try that.

Actually, I'm trying to treat imports for files outside the current project or even the workspace. It seems to me that creating a Resource objects for these files might help.
Previous Topic:grammar ignore until next keyword
Next Topic:Add my var in Quick Reference
Goto Forum:
  


Current Time: Thu Mar 28 23:10:16 GMT 2024

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

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

Back to the top