/** * If the given bundle is a {@link DelegatingBundle} this function will return the main * application bundle backing the {@link DelegatingBundle}. Otherwise, the bundle * passed in is returned as is. */ public static Bundle unwrapBundle(Bundle bundle) { if (bundle instanceof DelegatingBundle) { return ((DelegatingBundle) bundle).getMainBundle(); } return bundle; }
/** * Return the bundle associated with this classloader. * * In most cases the bundle associated with the classloader is a regular framework bundle. * However, in some cases the bundle associated with the classloader is a {@link DelegatingBundle}. * In such cases, the <tt>unwrap</tt> parameter controls whether this function returns the * {@link DelegatingBundle} instance or the main application bundle backing with the {@link DelegatingBundle}. * * @param unwrap If true and if the bundle associated with this classloader is a {@link DelegatingBundle}, * this function will return the main application bundle backing with the {@link DelegatingBundle}. * Otherwise, the bundle associated with this classloader is returned as is. * @return The bundle associated with this classloader. */ public Bundle getBundle(boolean unwrap) { if (unwrap && bundle instanceof DelegatingBundle) { return ((DelegatingBundle) bundle).getMainBundle(); } return bundle; }
/** * Return the bundle associated with this classloader. * * In most cases the bundle associated with the classloader is a regular framework bundle. * However, in some cases the bundle associated with the classloader is a {@link DelegatingBundle}. * In such cases, the <tt>unwrap</tt> parameter controls whether this function returns the * {@link DelegatingBundle} instance or the main application bundle backing with the {@link DelegatingBundle}. * * @param unwrap If true and if the bundle associated with this classloader is a {@link DelegatingBundle}, * this function will return the main application bundle backing with the {@link DelegatingBundle}. * Otherwise, the bundle associated with this classloader is returned as is. * @return The bundle associated with this classloader. */ public Bundle getBundle(boolean unwrap) { if (unwrap && bundle instanceof DelegatingBundle) { return ((DelegatingBundle) bundle).getMainBundle(); } return bundle; }
private synchronized LinkedHashSet<Bundle> getWiredBundles() { if (wiredBundles == null) { wiredBundles = BundleUtils.getWiredBundles((bundle instanceof DelegatingBundle) ? ((DelegatingBundle) bundle).getMainBundle() : bundle); } return wiredBundles; }