Is it a singleton?
If it is, you can do bind(CoreFetchOperationsImpl.class).in(Singleton.class);
which should do the trick.
On Jan 22, 2012, at 4:31 PM, egolan wrote:
> Hi,
> Suppose I have a class that implements two interfaces:
> public class CoreFetchOperationsImpl implements
> IDataCollector<CoreMpsData>, RecordsCounterOperations {...}
>
> So in order to bind the IDataCollector I would do:
>
> bind(new TypeLiteral<IDataCollector<CoreMpsData>>()
> {}).to(CoreFetchOperationsImpl.class);
>
> and for the RecordsCounterOperations I would:
> bind(RecordsCounterOperations.class).to(CoreFetchOperationsImpl.class);
>
> But now I have two instances of the concrete class.
>
> How can make Guice create only one CoreFetchOperationsImpl for both
> bindings?
>
> Thanks,
>
> Eyal
>
> --
> 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.
>
--
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.