samedi 26 septembre 2020

Unable to fetch classes of a package using Reflection

enter image description here

From the above image, when i am trying to fetch all classes under "tests", i am getting empty array.

    Reflections reflections = new Reflections("tests");
    //Reflections reflections = new Reflections("src.test.java.tests"); Tried but still empty array

     Set<Class<? extends Object>> allClasses =  reflections.getSubTypesOf(Object.class); //Getting empty array here
     Class[] arrayCls=new Class[allClasses.size()];
     allClasses.toArray(arrayCls);

Can someone please help me how to get array of classes?





Aucun commentaire:

Enregistrer un commentaire