0
我在我的(NS处理程序)这个Clojure的代码Clojure的DEFTYPE和协议
(defprotocol ActionHandler
(handle [params session]))
(defrecord Response [status headers body])
(deftype AHandler []
ActionHandler
(handle [params session]
(Response. 200 {"Content-Type" "text/plain"} "Yuppi, a-handler works")))
(deftype BHandler []
ActionHandler
(handle [params session]
(Response. 200 {"Content-Type" "text/plain"} "YES, the b-handler is ON")))
(deftype CHandler []
ActionHandler
(handle [params session]
(Response. 200 {"Content-Type" "text/plain"} "C is GOOD, it's GOOD!")))
在我core.clj我得到这个代码(省略几行和命名空间的东西):
(handle the-action-handler params session)
动作处理程序是deftype处理程序之一的有效实例。 当我尝试编译我得到这个错误:
java.lang.IllegalArgumentException: No single method: handle of interface: handlers.ActionHandler found for function: handle of protocol: ActionHandler
我没有读到时的参数数目无效传递到协议功能误导性的错误消息,但是,这并不像你所看到的情况。
可能是什么问题?有什么建议么? Greg
感谢。这正是我遇到的问题。 – greggigon