Package org.eclipse.sisu.space
Class URLClassSpace
- java.lang.Object
-
- org.eclipse.sisu.space.URLClassSpace
-
- All Implemented Interfaces:
ClassSpace
- Direct Known Subclasses:
CloningClassSpace
public class URLClassSpace extends java.lang.Object implements ClassSpace
-
-
Constructor Summary
Constructors Constructor Description URLClassSpace(java.lang.ClassLoader loader)Creates aClassSpacebacked by aClassLoaderand its default class path.URLClassSpace(java.lang.ClassLoader loader, java.net.URL[] path)Creates aClassSpacebacked by aClassLoaderwith a restricted class path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeferredClass<?>deferLoadClass(java.lang.String name)Defers loading of the named class from the surrounding class space.booleanequals(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.java.net.URLgetResource(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.java.net.URL[]getURLs()inthashCode()java.lang.Class<?>loadClass(java.lang.String name)Loads the named class from the surrounding class space.java.lang.StringtoString()
-
-
-
Constructor Detail
-
URLClassSpace
public URLClassSpace(java.lang.ClassLoader loader)
Creates aClassSpacebacked by aClassLoaderand its default class path.For
URLClassLoaders this is their expanded Class-Path; otherwise it is empty.- Parameters:
loader- The class loader to use when getting/finding resources
-
URLClassSpace
public URLClassSpace(java.lang.ClassLoader loader, java.net.URL[] path)Creates aClassSpacebacked by aClassLoaderwith a restricted class path.- Parameters:
loader- The class loader to use when getting resourcespath- The class path to use when finding resources- See Also:
getResources(String),findEntries(String, String, boolean)
-
-
Method Detail
-
loadClass
public final java.lang.Class<?> loadClass(java.lang.String name)
Description copied from interface:ClassSpaceLoads the named class from the surrounding class space.- Specified by:
loadClassin interfaceClassSpace- Parameters:
name- The class name- Returns:
- Class instance
- See Also:
ClassLoader.loadClass(String)
-
deferLoadClass
public final DeferredClass<?> deferLoadClass(java.lang.String name)
Description copied from interface:ClassSpaceDefers loading of the named class from the surrounding class space.- Specified by:
deferLoadClassin interfaceClassSpace- Parameters:
name- The class name- Returns:
- Deferred class
- See Also:
ClassLoader.loadClass(String)
-
getResource
public final java.net.URL getResource(java.lang.String name)
Description copied from interface:ClassSpaceQueries the surrounding class space for the resource with the given name.- Specified by:
getResourcein interfaceClassSpace- Parameters:
name- The resource name- Returns:
- URL pointing to the resource;
nullif it wasn't found - See Also:
ClassLoader.getResource(String)
-
getResources
public final java.util.Enumeration<java.net.URL> getResources(java.lang.String name)
Description copied from interface:ClassSpaceQueries the surrounding class space for all resources with the given name.- Specified by:
getResourcesin interfaceClassSpace- Parameters:
name- The resource name- Returns:
- Sequence of URLs, one for each matching resource
- See Also:
ClassLoader.getResources(String)
-
findEntries
public final java.util.Enumeration<java.net.URL> findEntries(java.lang.String path, java.lang.String glob, boolean recurse)Description copied from interface:ClassSpaceQueries local class space content for entries matching the given pattern.- Specified by:
findEntriesin interfaceClassSpace- Parameters:
path- The initial search directory; for example"META-INF"glob- The filename glob pattern; for example"*.xml"recurse- Iftruerecurse into sub-directories; otherwise only search initial directory- Returns:
- Sequence of URLs, one for each matching entry
- See Also:
Bundle.findEntries(String, String, boolean)
-
getURLs
public final java.net.URL[] getURLs()
-
hashCode
public final int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object rhs)
- Overrides:
equalsin classjava.lang.Object
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-