Original Java:
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
Filter idFilter = ff.id(ff.featureId("100"));
Clojure:
(let [^FilterFactory2 ff (CommonFactoryFinder/getFilterFactory2)
^Filter id-filter (.id ff (.featureId ff "100"))]
(do something...))
When I run this I get IllegalArgumentException No matching method found: id for class org.geotools.filter.FilterFactoryImpl clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:80)
I know that means it is unable to find a method id
for ff
. I searched the docs and there is an Id
property. I reviewed the Clojure Java Interop docs and it says the dot notation (.id ff)
should work for accessing Java properties. I am unsure how to change my code to get the proper result. I am good with Clojure but know very little about Java.
Re var length Java args:
To my understanding this question is not related to variable length Java arguments as the main fn ff.id(ff.featureId("100"));
takes only one argument (ff.featureId("100")
) which evaluates to a String
.