What I think sam is saying is that you want something more like:
public class ClientModule extends AbstractGinModule
{
@Override
protected void configure()
{
install(new GinFactoryModuleBuilder()
.implement(new TypeLiteral<A<MExt >>(){}, new
TypeLiteral<B<MExt>>(){})
.build(FactoryExt.class));
}
}
On Sat, Jul 30, 2011 at 4:50 AM, Alex Luya <[email protected]> wrote:
> nope
> On Fri, 2011-07-29 at 15:32 -0700, David Garcia wrote:
> > I have the same question, did you find out how to solve it?
> > Thanks
> >
> > On Jul 6, 11:53 pm, Alex Luya <[email protected]> wrote:
> > > Sorry,I tried && googlinged to figure out what you mean,but failed,can
> > > you post a concrete example?
> > >
> > > thx.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > On Wed, 2011-07-06 at 22:18 -0400, Sam Berlin wrote:
> > > > By using the TypeLiterals you put in the bind(..) statements in
> > > > the .implement(..) parameters and removing the bind statement, most
> > > > likely.
> > >
> > > > sam
> > >
> > > > On Wed, Jul 6, 2011 at 10:17 PM, Alex Luya <[email protected]
> >
> > > > wrote:
> > > > Yeah,but how to solve this problem?
> > >
> > > > On Thu, Jul 7, 2011 at 9:58 AM, Sam Berlin <
> [email protected]>
> > > > wrote:
> > > > Briefly glancing over it, you probably want to
> > > > use .implement with TypeLiterals, not classes.
> > >
> > > > sam
> > >
> > > > On Wed, Jul 6, 2011 at 9:51 PM, Alex Luya
> > > > <[email protected]> wrote:
> > >
> > > > Actually,I am using gin for GWT.Following are
> > > > my code:
> > > >
> ---------------------------------------------------------------------------
> ------------------
> > > > interface A<M extends Model>
> > > > {
> > > > //interface A
> > > > }
> > > >
> ---------------------------------------------------------------------------
> ----------------------
> > > > class B<M extends Model> implements A<M>
> > > > {
> > > > // implementation of A
> > > > }
> > > >
> ---------------------------------------------------------------------------
> ----------------------
> > > > class MExt extend Model
> > > > {
> > > > //this is inheritance of Model
> > > > }
> > > >
> ---------------------------------------------------------------------------
> ----------------------
> > > > interfaceFactory<M extends Model,V extends
> > > > A<M>>
> > > > {
> > > > V createA(M model);
> > > > }
> > > >
> ---------------------------------------------------------------------------
> ----------------------
> > > > public class ClientModule extends
> > > > AbstractGinModule
> > > > {
> > > > @Override
> > > > protected void configure()
> > > > {
> > > > bind(new TypeLiteral<A<MExt >>(){}).to(new
> > > > TypeLiteral<B<MExt>>(){});
> > > > install(new
> > > > GinFactoryModuleBuilder().implement(A.class,
> > > > B.class).build(Factory.class));
> > > > }
> > > > }
> > > >
> ---------------------------------------------------------------------------
> ----------------------
> > > > When trying to run,get these errors:
> > > >
> ---------------------------------------------------------------------------
> --------------------------
> > > > ......
> > >
> > > > 1)V cannot be used as a key; It is not fully
> > > > specified.
> > > > ......
> > > >
> ---------------------------------------------------------------------------
> --------------------------
> > >
> > > > So I tried to do this:add
> > > >
> ---------------------------------------------------------------------------
> --------------------------
> > > > interface FactoryExt extend
> > > > Factory<MExt,A<MExt>>{
> > > >
> ....................................................
> > > > }
> > > >
> ---------------------------------------------------------------------------
> --------------------------
> > > > and reconfigure module to
> > > >
> ---------------------------------------------------------------------------
> --------------------------
> > > > public class ClientModule extends
> > > > AbstractGinModule
> > > > {
> > > > @Override
> > > > protected void configure()
> > > > {
> > > > bind(new TypeLiteral<A<MExt >>(){}).to(new
> > > > TypeLiteral<B<MExt>>(){});
> > > > install(new
> > > > GinFactoryModuleBuilder().implement(A.class,
> > > > B.class).build(FactoryExt.class));
> > > > }
> > > > }
> > > >
> ---------------------------------------------------------------------------
> --------------------------
> > > > get this error:
> > > >
> ---------------------------------------------------------------------------
> --------------------------
> > > > ......
> > > > 1) Could not find a suitable constructor in
> > > > com.domain.client.ui.A. Classes must have
> > > > either one (and only one) constructor
> > > > annotated with @Inject or a zero-argument
> > > > constructor that is not private.
> > > > ......
> > > >
> ---------------------------------------------------------------------------
> --------------------------
> > > > it seems that guice didn't recognize this
> > > > clause:
> > > >
> -------------------------------------------------
> > > > bind(new TypeLiteral<A<MExt >>(){}).to(new
> > > > TypeLiteral<B<MExt>>(){});
> > > >
> ----------------------------------------------------
> > >
> > > > So,how can I solve this problem?
> > >
> > > > --
> > > > 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.
> > >
> > > > --
> > > > 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 google-guice
> > > > [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 google-guice
> > > > [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.
>
>
--
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.