On Jul 6, 6:59 pm, Nicolas Buduroi <nbudu...@gmail.com> wrote:
> Hi, I needed to call a static method on a class stored in a var
> yesterday and found that it was a little bit trickier than I initially
> thought.

My first impression is that this is probably not the best way to go
about this.  Java classes are not like Ruby or Python classes; you
can't just call methods on them.  Using "eval" is a hack, and probably
not a good idea.

If you can determine, in your code, which class is needed, then do
that and call the static method directly using the (ClassName/
methodName...) syntax.

If you really don't know what the class is (for example, you get a
Class object returned by some library function) then you can use the
Java Reflection API to call the static method.  See
http://java.sun.com/docs/books/tutorial/reflect/

-SS
--~--~---------~--~----~------------~-------~--~----~
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