I want to use a Java constructor as a first-class Clojure function. My use-case is to transform a sequence of strings into a sequence of Java objects that have a constructor with a single string:
Simple Java object:
public class Foo {
public Foo(String aString){
// initialize the Foo object from aString
}
}
And in Clojure I want to do this:
(defn make-foo (memfn Foo. a-string))
(apply make-foo '("one" "two" "shoe"))
The apply should return a list of Foo objects created from Strings, but I'm getting this:
IllegalArgumentException No matching method found: org.apache.hadoop.io.Text. for class java.lang.String clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:53)