开发者

Clojure proxy and @Override?

In Java when you wa开发者_开发百科nt to override something you use @Override sometimes. How can you do the same in a Clojure proxy?


Every method in a proxy should override a superclass method or an interface method, so it's a slightly different situation from a Java class where you can add new methods. So, if Clojure offered a way to mark proxy methods as overrides, then all valid proxies would have that annotation for each method.

Unfortunately, Clojure will let you define a method in a proxy that does not belong to any of the classes or interfaces that the proxy overrides. That method will not be callable or accessible in normal usage, however.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜