3

I am trying to get javafx2 working with Clojure - In implementing an abstract class such as DoubleBinding, I am unsure what the equivalent of super.bind(moo) is in Clojure. The class I am implementing can be found here: http://docs.oracle.com/javafx/2/api/index.html.

(def moo (ObservableDoubleValue. ...))
(def foo (proxy [DoubleBinding] []
 (computeValue []
 (Math/sqrt (.getValue moo)))))
final ObservableDoubleValue moo = ...; 
DoubleBinding foo = new DoubleBinding() {
 {
 super.bind(moo);
 }
 @Override
 protected double computeValue() {
 return Math.sqrt(moo.getValue());
 }
 };
asked Jul 27, 2012 at 2:55

1 Answer 1

1

According to proxy documentation, methods in proxy has no access to super... I would recommend you to generate class using gen-class and use it. You can access to super's methods if you'll expose them with :exposes-methods directive. Something, like:

(gen-class :name MyDoubleBinding
 :extends DoubleBinding
 :exposes-methods {bind my-bind}
 ....
 )

and then call -my-bind from your constructor...

Please, check documentation about class generation on Clojure's site for more details on gen-class

answered Jul 27, 2012 at 5:46
Sign up to request clarification or add additional context in comments.

2 Comments

What about proxy-super?
I have attempted to use proxy-super, however from what I have tested and read, it must be called from inside a method of the proxy. I have been testing gen-class and am unable to call .bindSuper in the post-init constructor, but still I try - it is very slow going since gen-class needs recompilation with each change.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.