com.atlassian.plugin.osgi.util
Class BundleClassLoaderAccessor
java.lang.Object
com.atlassian.plugin.osgi.util.BundleClassLoaderAccessor
public class BundleClassLoaderAccessor
- extends Object
Utility methods for accessing a bundle as if it was a classloader.
- Since:
- 2.3.0
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BundleClassLoaderAccessor
public BundleClassLoaderAccessor()
getClassLoader
public static ClassLoader getClassLoader(org.osgi.framework.Bundle bundle,
AlternativeResourceLoader alternativeResourceLoader)
- Creates a classloader that delegates to the bundle
- Parameters:
bundle - The bundle to delegate toalternativeResourceLoader - An alternative resource loader to bypass bundle, can be null
- Returns:
- A new classloader instance
loadClass
public static <T> Class<T> loadClass(org.osgi.framework.Bundle bundle,
String name)
throws ClassNotFoundException
- Loads a class from the bundle
- Type Parameters:
T - The type of the class- Parameters:
bundle - The bundlename - The name of the class to load
- Returns:
- The class instance
- Throws:
ClassNotFoundException - If the class cannot be found in the bundle
Copyright © 2010 Atlassian. All Rights Reserved.