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 {
>
>        @Override
>        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