Hi,

I'm a newbie on guice and tried to find the inverse annotation of
@ImplementedBy where a class can define that it provides the default
implementation of an interface?

An example:

I have a class that requires a Component for a field:
@Inject
private Component component;

Then I have the Component interface that specifies the implementing
class:
@ImplementedBy(ComponentImpl.class)
public interface Component() { ... }

This approach has a major drawback, the interface has a dependency to
the implementation class. In order to avoid that design problem, you
need the inverse annotation, something like:
@Provides(Component.class)
public class ComponentImpl() { ... }

But that seems to be not possible in guice. The only thing I found is
to provide a factory method with the @Provides annotation.

Am I missing something here? Or is that feature already planned in a
future release?

Ulli
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to