users@jersey.java.net

Refactoring of Injectable etc.

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 17 Apr 2008 14:00:02 +0200

Paul Sandoz wrote:
> Martin Grotzke wrote:
>>> So i think i am leaning towards the following:
>>>
>>> 1) Supporting injectable per annotation and injectable per
>>> annotation+type;
>>>
>>> 2) Use a new annotation as you previously said (you were right!)
>>> to specify deferring to an IoC framework;
>>>
>>> 3) Implement an injectable per annotation, from 1), for 2); and
>>>
>>> 4) Implement a parameter injectable for 2).
>>>
>>> Sound like a plan?
>> Like a good one - as far as I understand :)
>> I haven't looked at constructor/method parameter injection, so I have no
>> idea how this is realized - I'll have a look at the code to get an
>> idea...
>>
>
> Let's get 1 to 3 done first, then we can tackle the harder part :-)
>

Something just occurred to me related to the last task. The 0.8 version
of the 311 spec will change to allow the use of @*Param on bean setter
methods, for example

    @QueryParam("q")
    void setQ(String q) {
       ...
    }

Same goes for @Context:

    @Context
    void setUriInfo(UriInfo ui) {
       ...
    }

In addition @*Param injection onto fields will also be specified but
only for per-request resources.

This will require some refactoring of the parameter management, as is
the case for enabling externally-defined annotations on constructor or
method parameters.

We need to refactor the Injectable stuff to allow parameter, field or
bean setter injection. Given that reflection can be rather slow i
propose (as indicated earlier) that we need to have some specific
pre-calculated injector logic associated with a resource class that
takes in a set of injectables that can be applied to fields and bean
setters. Given that some injectables provide constant (per-web
application scope) values, the injectables could provide some
information to take advantage of that.

I propose that first we integrate the current Spring/ComponentProvider
related changes to the trunk after the 0.7 release. Then work on
unifying injector model to support all our requirements.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109