users@jsr311.java.net

Re: Annotations on interfaces and super classes <was> Re: URI Contracts

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 11 Jun 2008 10:41:56 -0400

On Jun 10, 2008, at 2:53 PM, Bill Burke wrote:
>
> @Local|_at_Remote
> @Path("/customers")
> public interface CustomerDAO {
> ...
> }
>
> Doesn't matter if its local or remote.
>

> Register a JNDI name as a context-param
>
> <context-param>
> <param-name>resteasy.jndi.resources</param-name>
> <param-value>
> java:comp/env/MyEJB
> </param-value>
> </context-param>
>
Neat !

So the key thing here is to be able to have annotations on interfaces
so you can "export" the JAX-RS information via an interface rather
than having it tied to an implementation class (which in this case is
an EJB). Your code only inspects the interface since the
implementation class is hidden from you by the EJB plumbing.

Interestingly, this isn't the functionality addressed by the
annotation inheritance defined by the spec (section 3.6). That is
targeted at making annotations on an abstract method available to a
runtime inspecting an implementation class. We could remove the
inheritance of annotations on abstract methods without impacting your
use case at all.

Marc.

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