I would like your opinion on my implementation on loading resources in my application that supports plug ins.
In my main application I have a resource handler class that I have exposed to my plug ins. This class was created as a helper class when plug ins try to get their resources.
public class ResourceHelper{
private Class<?> T;
public ResrouceHandler(Class<?> T){
this.T = T;
}
public BufferedImage getImageResource(String path){
T.getClassLoader().getResource()...
}
}
In order to use the helper the caller has to create an instance.
ResourceHelper resourceHelper = new ResourceHelper(getClass())
But I would prefer to not use the getClass() method anymore but rather have the ResourceHelper get the current classloader on its own. I have tried using Thread.currentThread().getContextClassLoader() but it doesnt seem to work.