Hi,
I'm trying to write some macros for java object instanciation. Here's
the code:
(defn- gen-object-method [my-class id option value]
(let [method (some (java-methods option) (map #(.getName %)
(.getMethods my-class)))]
(when (not method)
(throw (new java.lang.IllegalArgumentException (str "A
method for " option " was not found in class " component-class))))
(list (symbol (str "." method)) id value)))
(defmacro gen-java-code [my-class &body]
....
(gen-object-method myclass ~id arg val)
....)
Function gen-object-method is called from a macro (that tries to
generate java code). My problem is that my-class is a symbol and not a
java class, so that (.getMethod ) fails with
No matching field found: getMethods for class clojure.lang.Symbol
[Thrown class java.lang.IllegalArgumentException]
How can I check in a macro that a particular java method exists for a
class or not?
Thanks,
Razvan
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en