[英]Find a java class that extends an abstract class
我如何找到擴展另一個抽象類的類?
目前我有這個:
public PluginFinder(ClassLoader cl, File f) throws MalformedURLException, ClassNotFoundException {
super(new URL[]{f.toURI().toURL()}, cl);
Class<?> jarClass = Class.forName("com.ngxdev.demoplugin.main.MainClass", true, this);
this.instance = new PluginParser(jarClass).instance;
}
它可以工作,但是它是靜態的,我需要找到“ com.ngxdev.demoplugin.main.MainClass”而不指定它,因為據我所知,該位置可以是“ com.example.ExampleClass”。
我嘗試使用: Reflections reflections = new Reflections("my.project.prefix");
但我真的不知道如何使用它。
Reflections
也可以掃描文件,例如:
Reflections reflections = new Reflections(new File("/plugin/example.jar"));
使用這個庫
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.