On Wed, Nov 10, 2010 at 10:47 AM, Chris Carrier <ctcarrier_at_gmail.com> wrote:
> We created a CRUD framework using generics that kind of accomplishes
> what you want. Any new resource that needs normal CRUD functionality
> all we need to do is create the JPA annotated model class and then
> create an endpoint implementation that extends our abstract framework.
> All the logic is inherited like DB stuff, paging, validation etc...
> Not quite as light as you are talking but it's an option. For us
> having concrete endpoint implementations has some other advantages
> like gathering metrics and testing etc.
One possible way forward is bytecode generation; annotations can be
added similar to code using javassist I think (or even Asm if one has
to).
This would create actual classes at runtime, which could be fed to
JAX-RS framework.
It is some work, but would be nice, and if done properly would be nice
open source project to further simplify creation of simple web
services.
I used Asm myself for "bean materialization" (given an interface,
construct a concrete class with implied properties, getters, setters)
and it worked out quite well.
-+ Tatu +-