I am considering writing a REST Server using Clojure.
I have experience using RESTEasy with Java. It uses annotations to associate URLs, template parameters, and query parameters with Java classes, methods, and method parameters. I believe that the Jersey REST Server also uses annotations (since it, too, is based on JAX-RS).
Is it possible to use these frameworks with Clojure? Is there an official way to associate annotations with functions?
I found the answer in the forth-coming book “Clojure Programming”, by Chas Emerick, Brian Carper, and Christophe Grand.
If you define a new type with
deftype, you can add annotations the newly created class:I’m not sure if this will work with
gen-class. I’ll need to experiment.