java - Clojure -- how to define public mutable members using deftype? -


i've been trying http://docs.oracle.com/javafx/2/get_started/fxml_tutorial.htm running in clojure.

i discovered omitting @fxml annotation in java version , making things public, from:

public class fxmlexamplecontroller {     @fxml private text actiontarget;      @fxml protected void handlesubmitbuttonaction(actionevent event) {         actiontarget.settext("sign in button pressed");     } }  

to:

public class fxmlexamplecontroller {     public text actiontarget;       public void handlesubmitbuttonaction(actionevent event) {         actiontarget.settext("sign in button pressed");     } } 

...that still works when click button, , fxml able controller's public text actiontarget, access enabled via @fxml annotation.

so i'm trying make clojure-based controller class have public mutable fields, in last several hours of hunting through :gen-class , deftypes, can't find way make work. able access final (default) deftype fields java test code, online discussion i've seen says can't have public , mutable fields, , try :gen-class. well, can't find in gen-class either, , gen-class examples i've been able find use class fields within clojure; i'm not sure how define :state in :gen-class such accessible java, , don't know how make mutable , public.

my next thing try clojure annotations, , using fx:script field rather fx:controller define clojure callback... want make sure it's doable/not-doable deftype or gen-class first.

so can tell me if it's possible make java-accessible class public mutable fields in clojure?

thanks.

no, cannot define public mutable fields in clojure. applies both deftype , gen-class.

i suppose try , find out whether javafx happy call getter and, if so, define getfoo methods in clojure instead.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -