Package org.eclipse.sisu.space
Class BundleClassSpace
java.lang.Object
org.eclipse.sisu.space.BundleClassSpace
- All Implemented Interfaces:
ClassSpace
ClassSpace
backed by a strongly-referenced Bundle
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Chains a series ofEnumeration
s together to look like a singleEnumeration
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.osgi.framework.Bundle
private URL[]
private static final Enumeration<URL>
private static final URL[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeferLoadClass
(String name) Defers loading of the named class from the surrounding class space.boolean
findEntries
(String path, String glob, boolean recurse) Queries local class space content for entries matching the given pattern.org.osgi.framework.Bundle
private URL[]
Returns the expanded Bundle-ClassPath; we need this to iterate over embedded JARs.getResource
(String name) Queries the surrounding class space for the resource with the given name.getResources
(String name) Queries the surrounding class space for all resources with the given name.int
hashCode()
Class<?>
Loads the named class from the surrounding class space.toString()
-
Field Details
-
NO_URLS
-
NO_ENTRIES
-
bundle
private final org.osgi.framework.Bundle bundle -
bundleClassPath
-
-
Constructor Details
-
BundleClassSpace
public BundleClassSpace(org.osgi.framework.Bundle bundle)
-
-
Method Details
-
loadClass
Description copied from interface:ClassSpace
Loads the named class from the surrounding class space.- Specified by:
loadClass
in interfaceClassSpace
- Parameters:
name
- The class name- Returns:
- Class instance
- See Also:
-
deferLoadClass
Description copied from interface:ClassSpace
Defers loading of the named class from the surrounding class space.- Specified by:
deferLoadClass
in interfaceClassSpace
- Parameters:
name
- The class name- Returns:
- Deferred class
- See Also:
-
getResource
Description copied from interface:ClassSpace
Queries the surrounding class space for the resource with the given name.- Specified by:
getResource
in interfaceClassSpace
- Parameters:
name
- The resource name- Returns:
- URL pointing to the resource;
null
if it wasn't found - See Also:
-
getResources
Description copied from interface:ClassSpace
Queries the surrounding class space for all resources with the given name.- Specified by:
getResources
in interfaceClassSpace
- Parameters:
name
- The resource name- Returns:
- Sequence of URLs, one for each matching resource
- See Also:
-
findEntries
Description copied from interface:ClassSpace
Queries local class space content for entries matching the given pattern.- Specified by:
findEntries
in interfaceClassSpace
- Parameters:
path
- The initial search directory; for example"META-INF"
glob
- The filename glob pattern; for example"*.xml"
recurse
- Iftrue
recurse into sub-directories; otherwise only search initial directory- Returns:
- Sequence of URLs, one for each matching entry
- See Also:
-
Bundle.findEntries(String, String, boolean)
-
getBundle
public org.osgi.framework.Bundle getBundle() -
hashCode
public int hashCode() -
equals
-
toString
-
getBundleClassPath
Returns the expanded Bundle-ClassPath; we need this to iterate over embedded JARs.
-