vendredi 16 mars 2018

JavaFX bind acceptProgress through reflection

I have to guide a updateProgress(0,5) through multiple classes. For that I use this:

Class.setProgressUpdate(progressUpdate::accept);

I now however call a class with a reflection, like this:

Class cls = Class.forName("package." + ArrayList<String>.get(currentIndex));
    Constructor<Class> constructorStr = cls.getConstructor(ArrayList.class, ArrayList.class, TextArea.class);
    Object obj =  constructorStr.newInstance(ArrayList<String>, ArrayList<String>, TextArea);

    Class[] params = new Class[2];
    params[0] = ArrayList.class;
    params[1] = String.class;

    Method method = method = cls.getDeclaredMethod("methode1", params);
    method.invoke(obj, ArrayList<Integer>, int);

How could I use the setProgressUpdate method with this reflection?





Aucun commentaire:

Enregistrer un commentaire