Well, I couldn't wait, so I walked through what guiceyfruit was doing
and managed to accomplish what I needed using a custom TypeListener
and MembersInjector (without guiceyfruit).

Works great!  I'm quite pleased with the result.  For anyone looking
to solve this problem in the future, I recommend using this solution
(or guiceyfruit, which is more polished).  It would be grand if Guice
supported it directly, but as a workaround this solution seems
scalable and pretty efficient. I had thought it wasn't possible
previously, but now at least I know it is even if it's not as
convenient as a standard Provider.

Thanks James,

Mike





On Jul 30, 11:44 am, Michael Burton <[email protected]> wrote:
> Great James, it looks like that's very much along the lines of what  
> I'm looking for.  I'll try it out sometime in the next few weeks.
>
> It seems like I've been reading a lot of "yeah that would be nice"  
> posts about being able to read attribute values from within  
> providers.  It certainly would help me for Android and other  
> projects.  Guice maintainers, any thoughts about incorporating this  
> into Guice?
>
> Cheers,
> Mike
>
>
>
> > GuiceyFruit currently focusses on using an annotation to specify a
> > parameterised injection point (like @Resource) which only tends to
> > work on a field or property injection point - not on annotations on
> > parameters at a regular @Inject injection point.
>
> > If you did it more like this...
>
> > @StringResource(R.string.foobar)
> > public void setString(  String foobar)
>
> > then you could bind the StringResource annotation as an injection
> > point like the way @Resource is supported; you can then write a kind
> > of provider which takes the StringResource annotation and uses its
> > values to create an object.
>
> > e.g.
>
> >http://code.google.com/p/guiceyfruit/source/browse/trunk/guiceyfruit-...
>
> > for code sharing reasons much of the heavy lifting is actually in this
> > base class
>
> >http://code.google.com/p/guiceyfruit/source/browse/trunk/guiceyfruit-...
>
> > So in GuiceyFruit you'd implement a class which extends
> > AnnotationMemberProviderSupport<StringResource> then you bind it in
> > your GuiceyFruitModule via the bindAnnotationInjector() method
> >http://code.google.com/p/guiceyfruit/source/browse/trunk/guiceyfruit-...
--~--~---------~--~----~------------~-------~--~----~
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