Use ClassLoaders.ownsClass(loader, targetClass) to identify which
ClassLoader owns a given class. Basically compare
MyClass.class.getClassLoader() to addon.getClassLoader().
On Fri, Aug 15, 2014 at 12:01 AM, Ondrej Zizka <firstname.lastname@example.org> wrote:
let's say I want to look for a class, but only in given Addon's scope.
I.e. not in it's dependencies.
How would I do that, in an effective way?
addon.getClassLoader().loadClass() would give me (I suppose) transitive
classloaders' results too.
addon.getRepository().getAddonResources(addon.getId()) and traversing
the results seems to be ugly solution.
windup-dev mailing list
Lincoln Baxter, III
"Simpler is better."
att1.html.zip 842 bytes
Is there a direct (1-method) way to get a set of classes contained in given addon, or directly loaded / loadable by given addon's classloader?
No such convenience method exists (but you can use `ClassLoaders.ownsClass(clazz)` to do this comparison.