Some background, I'd like to write a Clojure Jersey generator. Here's some examples of Jersey: http://jersey.java.net/nonav/documentation/latest/jax-rs.html#d4e188 To me it seems like it's like compojure but more verbose. Since Jersey needs a class and methods with specific annotations on it, I figured I'd use gen-class.
As an api, I'd pretty much want it to be compojure's API. As an example: (GET "/user/:id" [id] (str "<h1>Hello user " id "</h1>")) This would generate a Jersey class that looks like this: @Produces(MediaType.TEXT_HTML) public class JerseyResource { @GET @Path("user/{id}") public String user(@PathParam("id") Integer id) { .... } } And in clojure, this would be some code that looks like this: (ns clj-jersey-resource (:import (javax.ws.rs Path PathParam Produces GET)) (:import (javax.ws.rs.core MediaType))) (defn -user [this id] ...) (gen-class :name ^{Path {:value "v2"} Produces {:value ["application/json"]}} myclass.CljJerseyResource :methods [[^{GET {}} user [Integer] String]]) I'm stuck because gen-class takes a list for :methods and I can't figure out how to make my one api call (ie: GET) generate both the signature of the method inside the gen-class and the implementation of the function outside of gen-class simultaneously. Even more confusing, if GET is called twice, I want this to define two separate methods in the same gen-class. How can I implement this? -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.