users@jersey.java.net

Re: [Jersey] Annotated Annotations

From: Wilfred Springer <wilfredspringer_at_gmail.com>
Date: Mon, 14 Jul 2008 23:20:40 +0200

Hmmmm, that's slightly different than what I had in mind - I think. I wrote
down my thoughts here:

http://agilejava.com/blog/?p=162


2008/7/14 Matt Brozowski <brozow_at_opennms.org>:

> I guess what I was thinking was that if while doing resource scanning, if
> it failed to find an certain annotation (such as @PerRequest) directly on a
> class, but it was annotated with annotations who were themselves annotated
> then the class should be considered to be annotated.
>
> I hope that's clear,
> Matt
>
>
>
>
> On Mon, Jul 14, 2008 at 4:22 PM, Wilfred Springer <
> wilfredspringer_at_gmail.com> wrote:
>
>> Interesting that you bring it up in this context. I've been thinking about
>> something similar in a completely different context.
>>
>> That is, if I understand you right. Do I get it right you are basically
>> asking for something like (for lack of a better term) macro annotations?
>> Annotations that will be expanded into a number of other annotations at
>> runtime? Because that's basically what I am thinking of.
>>
>> There are many areas in which they could be useful, so maybe we don't need
>> something JAX-RS specific, but something a little more general instead.
>>
>> I could imagine that you would define macro annotations using....
>> annotations. I will see if I can create an example of what I mean and send a
>> link.
>>
>> 2008/7/14 Matt Brozowski <brozow_at_opennms.org>:
>>
>> It would be nice if I could define new annotations that function the same
>>> way as various of the JAX-RS / Jersey annotations.
>>>
>>> This would enable me to aggregate a set of the Annotations that I'd like
>>> to combine into a single annotation that I could then apply to my Resources
>>> and Providers.
>>>
>>> An example of a use case for this is as follows:
>>>
>>> I use the Spring integration contribution so I can work with Spring
>>> wiring of my resources. These resources are annotated with Spring specific
>>> annotations related to lifecycle and such as well as to indicate that they
>>> are spring components.
>>>
>>> I also need to Annotate these resources with Jersey annotations that
>>> indicate the lifecycle of the beans and the two must match or things just
>>> don't work.
>>>
>>> I was thinking that it would be nice to define a new annotation of my own
>>> I could use that would in turn be annotationed with the appropriate Jersey
>>> and Spring annotations so that I could use a single lifecycle annotation
>>> that would tell each IoC container the lifecycle of the component.
>>>
>>> Spring's @Component annotation works this way and I thought it would make
>>> sense for the Jersey / JAX-RS annotations as well.
>>>
>>> Any thoughts on this?
>>> Matt
>>>
>>>
>>> ___________________________________________________________________________
>>> Matt Brozowski, OpenNMS Maintainer Main: +1 919 812 4984
>>> The OpenNMS Group, Inc. Fax: +1 503 961 7746
>>> Email: brozow@opennms.org URL: http://www.opennms.com
>>>
>>>
>>
>