public class

BundleClassLoaderAccessor

extends Object
java.lang.Object
   ↳ com.atlassian.plugin.osgi.util.BundleClassLoaderAccessor

Class Overview

Utility methods for accessing a bundle as if it was a classloader.

Summary

Public Constructors
BundleClassLoaderAccessor()
Public Methods
static ClassLoader getClassLoader(Bundle bundle, AlternativeResourceLoader alternativeResourceLoader)
Creates a classloader that delegates to the bundle
static <T> Class<T> loadClass(Bundle bundle, String name)
Loads a class from the bundle
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public BundleClassLoaderAccessor ()

Public Methods

public static ClassLoader getClassLoader (Bundle bundle, AlternativeResourceLoader alternativeResourceLoader)

Creates a classloader that delegates to the bundle

Parameters
bundle The bundle to delegate to
alternativeResourceLoader An alternative resource loader to bypass bundle, can be null
Returns
  • A new classloader instance

public static Class<T> loadClass (Bundle bundle, String name)

Loads a class from the bundle

Parameters
bundle The bundle
name The name of the class to load
Returns
  • The class instance
Throws
ClassNotFoundException If the class cannot be found in the bundle