On Tue, Jan 10, 2012 at 5:46 PM, Norman Gray <[email protected]> wrote:
>
> Greetings.
>
> I've run into a situation which (I think) is the Clojure analogue of
> <http://stackoverflow.com/questions/5672778/class-getmethod-when-parameter-is-varargs>,
> and I'm not sure how to apply the solution there to Clojure (I'm a Clojure
> beginner, though familiar with Java and with various Schemes).
>
> That is, I want to call a Java method with varargs and , if I'm understanding
> my problem correctly, (a) I can't do so straightforwardly using '.' in
> Clojure, and (b) I can't work out how to call .getMethod correctly.
>
> Using the stackoverflow problem as an example, it seems that I can't do
>
> (.queryForObject jdbcTemplate rowMapper)
I think your only problem here is that you're short an argument. If
you want to call a function with varargs, you must provide an array
that contains them. If you don't want any arguments, you still have to
pass the empty array.
ie: (.queryForObject jdbcTemplate rowMapper (make-array Object 0))
Side note, it might actually be easier to use the overload that takes
a map as its final parameter, you could just use a normal clojure {}
in that case.
--
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