Hello,

Two more queries:
1)  Can you give me an example on how a Provider<Store> instance can
access the Entity being saved in the above DefaultCIService#add
implementation?
2)  I suppose I need to get a handle to Guice injector to be able to
look up the appropriate Store instance by using the Entity class
(Human.class, Aninmal.class) as key, right?

Thanks,

Rahul


On Sep 30, 12:44 am, jordi <[EMAIL PROTECTED]> wrote:
> hey,
>
> maybe a Provider<Store> could be a solution and get what you need at
> runtime. otherwise you can inject that Provider, or one Provider for each
> Store you have,. like Provider<HumanStore>, Provider<AnimalStore>
>
> anyways, using Guice API is not bad at all! is there for something good
>
> jordi
>
> On Mon, Sep 29, 2008 at 11:33 AM, Rahul <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I am a newbie with Guice, so please excuse my shallow understanding...
>
> > To illustrate my use case, I have an implementation of an interface as
> > below:
>
> > public class DefaultCIService implements CIService {
>
> >       [EMAIL PROTECTED]
> >        public <T extends CommonUpdatableEntity> Long add(T entity) throws
> > CIServiceException {
> >                // TODO Implement!
> >                return null;
> >        }
>
> >        //.. omitted
> > }
>
> > Based on the actual instance's Type above (any extensions of
> > CommonUpdatableEntity - Human, Animal),  I would like to choose an
> > underlying Store implementation (ex: HumanStore for Human, AnimalStore
> > for Animal etc) to persist it. Here's what the Store looks like:
>
> > public interface Store<T extends CommonUpdatableEntity, Q extends
> > Query<T>> {
>
> >  public T save(T entity) throws StoreException;
>
> > }
>
> > So, when DefaultCIService#add(human:Human) is invoked, I want to
> > choose HumanStore. What is the best way to do it with Guice? I suspect
> > I would need to use Guice APIs - is that a bad thing?
>
> > Appreciate all pointers.
>
> > Cheers,
> > Rahul
--~--~---------~--~----~------------~-------~--~----~
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