Hello,

You must create a factory instead of using a Provider. To help you, the
extension AssistedInject exists.

More details in the wiki:
http://code.google.com/p/google-guice/wiki/AssistedInject


Regards,
Olivier



2009/4/21 ale <[email protected]>

>
> How can i do this.?
>
> public class CommandProvider implements Provider<Command> {
>
>        public Command get(runtimeValue1, runtimeValue2) {
>
>                if(runtimeValue1.equals( "commandX" )) {
>
>                        return new FooCommandX( runtimeValue2 );
>
>                } else if (runtimeValue1.equals( "commandY" )) {
>
>                        return new FooCommandY(runtimeValue2);
>
>                } else if (runtimeValue1.equals( "commandZ" )) {
>
>                        return new FooCommandZ(runtimeValue2);
>
>                } else {
>                    throw new RuntimeException("...."); //For this i
> know that i should use ThrowingProviders.
>                }
>
>        }
>
> }
>
> Thanks.
> >
>


-- 
Olivier Grégoire
Boulevard De Smet De Naeyer 627A
1020 Bruxelles
Tél: +32.486.74.09.49

--~--~---------~--~----~------------~-------~--~----~
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