In this example – http://jscience.org/api/javax/measure/package-summary.html, when I try to run in clojure, I get an error.
(import 'javax.measure.unit.SI)
(import 'javax.measure.Measure)
(Measure/valueOf 2 SI/KILOGRAM)
;; => More than one matching method found: valueOf
[Thrown class java.lang.IllegalArgumentException]
Is there anyway around this?
update
the actual java code is this:
public static <Q extends Quantity> Measure<java.lang.Integer, Q> valueOf(
int intValue, Unit<Q> unit) {
return new Integer<Q>(intValue, unit);
}
public static <Q extends Quantity> Measure<java.lang.Float, Q> valueOf(
float floatValue, Unit<Q> unit) {
return new Float<Q>(floatValue, unit);
}
the error I get is:
More than one matching method found: valueOf [Thrown class java.lang.IllegalArgumentException] Restarts: 0: [QUIT] Quit to the SLIME top level Backtrace: 0: Compiler.java:2360 clojure.lang.Compiler.getMatchingParams 1: Compiler.java:1555 clojure.lang.Compiler$StaticMethodExpr. 2: Compiler.java:938 clojure.lang.Compiler$HostExpr$Parser.parse 3: Compiler.java:6455 clojure.lang.Compiler.analyzeSeq 4: Compiler.java:6262 clojure.lang.Compiler.analyze 5: Compiler.java:6223 clojure.lang.Compiler.analyze 6: Compiler.java:5618 clojure.lang.Compiler$BodyExpr$Parser.parse 7: Compiler.java:5054 clojure.lang.Compiler$FnMethod.parse 8: Compiler.java:3674 clojure.lang.Compiler$FnExpr.parse 9: Compiler.java:6453 clojure.lang.Compiler.analyzeSeq
Here are a few basic casting examples: