public final class BundleClassSpace extends java.lang.Object implements ClassSpace
ClassSpace
backed by a strongly-referenced Bundle
.Modifier and Type | Class and Description |
---|---|
private static class |
BundleClassSpace.ChainedEnumeration<T>
Chains a series of
Enumeration s together to look like a single Enumeration . |
Modifier and Type | Field and Description |
---|---|
private org.osgi.framework.Bundle |
bundle |
private java.net.URL[] |
bundleClassPath |
private static java.util.Enumeration<java.net.URL> |
NO_ENTRIES |
private static java.net.URL[] |
NO_URLS |
Constructor and Description |
---|
BundleClassSpace(org.osgi.framework.Bundle bundle) |
Modifier and Type | Method and Description |
---|---|
DeferredClass<?> |
deferLoadClass(java.lang.String name)
Defers loading of the named class from the surrounding class space.
|
boolean |
equals(java.lang.Object rhs) |
java.util.Enumeration<java.net.URL> |
findEntries(java.lang.String path,
java.lang.String glob,
boolean recurse)
Queries local class space content for entries matching the given pattern.
|
org.osgi.framework.Bundle |
getBundle() |
private java.net.URL[] |
getBundleClassPath()
Returns the expanded Bundle-ClassPath; we need this to iterate over embedded JARs.
|
java.net.URL |
getResource(java.lang.String name)
Queries the surrounding class space for the resource with the given name.
|
java.util.Enumeration<java.net.URL> |
getResources(java.lang.String name)
Queries the surrounding class space for all resources with the given name.
|
int |
hashCode() |
java.lang.Class<?> |
loadClass(java.lang.String name)
Loads the named class from the surrounding class space.
|
java.lang.String |
toString() |
private static final java.net.URL[] NO_URLS
private static final java.util.Enumeration<java.net.URL> NO_ENTRIES
private final org.osgi.framework.Bundle bundle
private java.net.URL[] bundleClassPath
public java.lang.Class<?> loadClass(java.lang.String name)
ClassSpace
loadClass
in interface ClassSpace
name
- The class nameClassLoader.loadClass(String)
public DeferredClass<?> deferLoadClass(java.lang.String name)
ClassSpace
deferLoadClass
in interface ClassSpace
name
- The class nameClassLoader.loadClass(String)
public java.net.URL getResource(java.lang.String name)
ClassSpace
getResource
in interface ClassSpace
name
- The resource namenull
if it wasn't foundClassLoader.getResource(String)
public java.util.Enumeration<java.net.URL> getResources(java.lang.String name)
ClassSpace
getResources
in interface ClassSpace
name
- The resource nameClassLoader.getResources(String)
public java.util.Enumeration<java.net.URL> findEntries(java.lang.String path, java.lang.String glob, boolean recurse)
ClassSpace
findEntries
in interface ClassSpace
path
- The initial search directory; for example "META-INF"
glob
- The filename glob pattern; for example "*.xml"
recurse
- If true
recurse into sub-directories; otherwise only search initial directoryBundle.findEntries(String, String, boolean)
public org.osgi.framework.Bundle getBundle()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object rhs)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
private java.net.URL[] getBundleClassPath()