2009/3/27 Bob Lee <[email protected]>:
> On Fri, Mar 27, 2009 at 6:32 AM, James Strachan <[email protected]>
> wrote:
>>
>> As an aside - I tried noodling the recent changes and couldn't quite
>> get my head around them - any chance you could hack up a little test/
>> demo to show how the new stuff is meant to be used to implement a
>> custom injection point like @Resource? :)
>
> Definitely will do. In the mean time, your injectable type listener runs
> once when a type is first encountered, and it should do the up-front
> reflection work. It will find all methods annotated w/ @Resource, and then
> it will create a list of Pair<Method, Provider<Object>> objects that contain
> the method to be injected and the provider that provides the object to be
> injected. The injectable type listener registers an injection listener. The
> injection listener just iterates through the list of pairs, gets an object
> from the provider, and invokes the method passing in the provided object. In
> other words, the injection listener will be very fast and not even perform
> any lookups. In the injectable type listener, you use the Encounter to get
> the provider, register the injection listener, report errors, etc.

Great stuff - thanks for the heads up. That clears alot of confusion I had :)

Are you planning on adding a kinda higher level above the injectable
type listener so its easier to register providers for annotated
elements; or is whats there now the hooks you were thinking of and
everything else is up to the developer?

e.g. I'd like in a module to write code something vaguely like

bindAnnotationProvider(Resource.class, new
AnnotatedElementProvider<Resource.class>() {
  Object provideValue(Resource annotation, AnnotatedElement element) {
    ...
  }
});

giving the provider method access to the annotation & annotated
element (so things like the field/method name could be used) and
internally it would be doing the iteration over fields/methods to find
one with @Resource on it say.

I'm just wondering if its worth my time writing another patch that
never gets applied or should I just wait a while :)

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

--~--~---------~--~----~------------~-------~--~----~
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