If I understood correctly, you could:
1. define a parameter of type InjectionPoint in your provider method
2. call injectionPoint.getMember().getDeclaringClass()

which should give you the class that declares the injection point. From the
class, you can easily get the package.
Is that of any help?

wujek

On Tue, Aug 14, 2012 at 7:18 AM, Tim Boudreau <niftin...@gmail.com> wrote:

> I ran into a problem with the above strategy today, which suggests it's
> not really the right way to do it.  So I'll renew my plea for any
> suggestions.
>
> In a nutshell, what I'm after is a supported way to
>  - In a Provider, get a Class object for the type being injected into (as
> in, if my provider being called to inject a parameter into an instance of
> Foo, I want to get Foo.class)
>  - Look up an annotation on that *class* (not the parameter), or its
> Package (and similarly for interfaces and supertypes), and decide what the
> Provider should return based on that
>
> The purpose is to allow legacy code which gets configuration from a
> variety of files to use injection with minimal code changes and minimal
> invasiveness - i.e. you just annotate the package to indicate where
> settings are loaded from, and the plumbing looks things up from the right
> place.
>
> Any thoughts?
>
> Thanks,
>
> Tim
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-guice/-/3OMFPpB9BXIJ.
> To post to this group, send email to google-guice@googlegroups.com.
> To unsubscribe from this group, send email to
> google-guice+unsubscr...@googlegroups.com.
> 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 google-guice@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to