我在即将出版的书"Clojure Programming"中找到了答案,Chas Emerick,Brian Carper和Christophe Grand.
如果使用定义新类型deftype,则可以为新创建的类添加注释:
(ns my.resources
(:import (javax.ws.rs Path PathParam Produces GET)))
(definterface PersonService
(getPerson [^Integer id]))
(deftype ^{Path "/people/{id}"} PersonResource []
PersonService
(^{GET true
Produces ["text/plain"]}
getPerson
[this ^{PathParam "id"} id]
; blah blah blah
))
Run Code Online (Sandbox Code Playgroud)
我不确定这是否合适gen-class.我需要做实验.
| 归档时间: |
|
| 查看次数: |
1484 次 |
| 最近记录: |