Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Recommenders/ExtensionFactory

< Recommenders
Revision as of 12:16, 4 February 2011 by Unnamed Poltroon (Talk) (New page: The ExtensionFactory class can be found in bundle ''org.eclipse.recommenders.commons.injection''. The ExtensionFactory is used to automatically invoke dependency injection on classes defin...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The ExtensionFactory class can be found in bundle org.eclipse.recommenders.commons.injection. The ExtensionFactory is used to automatically invoke dependency injection on classes defined as extensions. In concrete, the ExtensionFactory instantiates the extension using guice for dependency injection. This enables you to use @Inject annotations on your fields or on the constructor.

Let's look at an example:

public class MyView extends ViewPart {

   @Inject
   private Service service;

   @Inject
   public MyView(ConfigurationObject configuration) {

...  

As you can see the improvement is that you can define needed objects in the constructor, because you don't rely on a default constructor anymore and you completely hide the code requesting injection on your fields.


How to use the ExtensionFactory

Back to the top