lundi 5 décembre 2016

How can I get declared classes in method?

This is Test class.

package com.reflection;

import com.reflection.test.A

public class Main {
  public void setA() {
    A a = new A();
  }
}

Then, I used ClassLoader for accessing and manipulating classes, fields, methods, and constructors as the code below

Class cls = cl.loadClass("com.reflection.Main");

Actually I really want to get A class by using cls and already tried to use getDeclaredClasses and getClasses but the result was nothing.





Aucun commentaire:

Enregistrer un commentaire