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-core/src/main/java/org/guiceyfruit/jsr250/ResourceMemberProvider.java > > 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-core/src/main/java/org/guiceyfruit/jsr250/NamedProviderSupport.java > > 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-core/src/main/java/org/guiceyfruit/jsr250/Jsr250Module.java --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
