I'm working with Jython. I'm trying to call a method inside a Java class using getDeclaredMethod.
My problem is that the method I want to call has one parameter of type double and this type does not exist in Jython. So, if I call the method with java.lang.Double type, it throws me the error java.lang.NoSuchMethodException, because Double is different than double.
For example, my method is the following:
public void calculateDate(double value, Date startdate)
And I'm trying to use the following code to call the method:
classesParameters = [Double, Date]
calculateDateMethod = javaobject.getClass().getDeclaredMethod("calculateDate", classesParameters)
calculateDateMethod.setAccessible(True)
objects = [24.33, startDate]
dateCalculation = calculateDateMethod.invoke(javaobject, objects)
How can I get around this?
BR
Aucun commentaire:
Enregistrer un commentaire