dev@jsr311.java.net

Re: JSR311: _at_Target of FIELD for _at_*Param annotations

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Fri, 07 Mar 2008 16:27:23 -0500

On Mar 7, 2008, at 2:45 PM, Stephan Koops wrote:

> Hello Marc,
>>>> It would bother me if we added new targets but didn't define what
>>>> should happen if a developer uses those targets. E.g. if we added
>>>> FIELD as a target for @PathParam then I think we'd have to
>>>> require implementations to support that annotation on resource
>>>> class fields. That's fine for the per-request resource life cycle
>>>> but what about singleton resources...
>>> @*Param on fields could be used the same as @Context.
>> Injecting a thread-local proxy won't work for primitive types.
> ??
>
> I meant that resource class fields could be annotated with @*Param
> and injected as @Context annotated fields on resource classes fields.
>
Yes, I was pointing out that:

public class SomeClass {

   @PathParam("id") int id;

   ...
}

will cause problems if SomeClass is a singleton because you can't
(AFAIK) proxy an int.

Marc.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.