私のシナリオ:
クラスは、ClassLoader を使用して多数の異なるクラスからロードされます。
別のクラスをロードするクラスからメソッドと変数を取得するにはどうすればよいですか? つまり、名前がわからないクラスからメソッドと変数を取得します。
例:
public class MainClass {
public static String str = "hey";
public static void main(String[] args) {
//load the OtherClass class, create an instance of it, and invoke its run method
}
}
public class OtherClass {
public void run() {
//get all variables of the class that instantialized the class
}
}
スタックオーバーフローを検索しましたが、運がありません:/
どんな助けでも感謝します:)。
マイク。