Hi,

Sorry for the newbie question, but I am trying to understand how to
construct and call java dynamically from clojure.
As an example, imagine that there is a bean property called "Bla" and
one wants to set Bla to 1 on object x, which has that property.
So, the objective would be to construct, the following java equivalent

x.setBla(1);

I defined a macro called setProperty like this:
(setProperty "Bla" x 1)

And the definition is (very wrong):
(defmacro setProperty [field obj value]
  `(let [cct# (symbol (.concat ".set" ~field))]
    (cct# ~obj ~value)
  )
)

If I do

(println (setProperty "Bla" x 1))
I get 1 (the setBla is a void, so I should not get 1).
bla is never set to 1, by the way :(

Note that I am not trying to sort the particular case of beans. I am
trying to understand the general mechanism to construct symbols (java
interop) and execute them with a set of parameters over a java object.

Thanks a lot and sorry for the newbie question,
T

-- 
"The hottest places in hell are reserved for those who, in times of
moral crisis, maintain a neutrality." - Dante

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to