Did you try using Matchers.subclassesOf(InitableAfterCreation.class)?
On Tue, Aug 20, 2013 at 8:20 PM, <[email protected]> wrote: > Sorry that I'm still not 100% sure, and I do not have a test case to show, > but I'm pretty sure I did find the main cause of this "issue" in my > application. > > I created an interface : > > ------------- > public interface IInitableAfterCreation > { > public void init(); > } > ------------- > > And this is what I check in the *Matcher* of my *InjectionListener* : > > ------------- > @Override > public boolean matches(Binding<?> t) > { > return > IInitableAfterCreation.class.isAssignableFrom(t.getKey().getTypeLiteral().getRawType()); > } > ------------- > > The problem is that I was using this *IInitableAfterCreation* interface > on my *implementations* objects, not on their interfaces. For example : > > ------------- > public class MyWidget implements IMyWidget, IInitableAfterCreation > { > @Override > public void init() > { > } > // ... > } > ------------- > > This doesn't work! But if I make the* IMyWidge*t *interface* extend > *IInitableAfterCreation > *, then it works : > > ------------- > public interface IMyWidget extends IInitableAfterCreation {} > > public class MyWidget implements IMyWidget > { > @Override > public void init() > { > } > // ... > } > ------------- > > Is this the way it should work? Some of my *IMyWidget* implementations > that don't need to be initialized at startup will still have to implement > the *init()* method? > > Anyway, the issue seems less important than what I though, that's good > news! :-) > > Let me know if you still want a test case or if this is not a real problem > actually (I would appreciate to better understand the way it works > though!). Thanks! > > > ******** > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/google-guice. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-guice. For more options, visit https://groups.google.com/groups/opt_out.
