开发者

How to write the following class in Clojure?

开发者 https://www.devze.com 2023-03-01 03:58 出处:网络
I want to write the following in Clojure, but I can\'t figure it out for the life of me: new TouchCommand() {

I want to write the following in Clojure, but I can't figure it out for the life of me:

new TouchCommand() {

    @Override
    public void itemTouched(TouchMenuItem selectedItem) {
  开发者_如何学Python  }

I tried:

(reify com.vaadin.touchkit.TouchMenu$TouchCommand 
  (itemTouched [^com.vaadin.touchkit.TouchMenu$TouchMenuItem item]))

but it returns:

java.lang.IllegalArgumentException: Can't define method not in interfaces: itemTouched 

even though "itemTouched" does exist in the interface. Can anyone help?


I haven't done extensive Java interop with Clojure so this might be wrong, but how about

(proxy [TouchCommand] []
  (itemTouched [selectedItem]
               (.. (getParent)
                   (navigateTo
                     (UiBasics.)))))
0

精彩评论

暂无评论...
验证码 换一张
取 消