On Wed, 2 Jun 2010 13:33:30 +0200
Konrad Hinsen <[email protected]> wrote:
> Constructors calls translate directly to Java constructor calls, meaning that
> the number of arguments must be known at compile time.
>
> Assuming your constructor takes a fixed number of arguments, the easiest
> solution to your problem is to wrap the constructor in a function:
>
> (apply (fn [p1 p2] (new Connection.Configuration p1 p2)) params)
>
> If your class has multiple constructors with different arity, there are ways
> to look up the right constructor using reflection, but I have forgotten the
> details already.
Can you let the fn call figure that out for you? Like so:
(apply (fn ([p1 p2] (new Connection.Configuration p1 p2))
([p1 p2 p3] (new Connection.Configuration p1 p2 p3)))
params)
I realize that reflection is probably better in this case, but was
wondering if this would work.
<mike
--
Mike Meyer <[email protected]> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
--
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