public class ClassLoaderServiceImpl extends Object implements ClassLoaderService
Modifier and Type | Class and Description |
---|---|
static interface |
ClassLoaderServiceImpl.Work<T>
Hack around continued (temporary) need to sometimes set the TCCL for code we call that expects it.
|
Constructor and Description |
---|
ClassLoaderServiceImpl()
Constructs a ClassLoaderServiceImpl with standard set-up
|
ClassLoaderServiceImpl(ClassLoader classLoader)
Constructs a ClassLoaderServiceImpl with the given ClassLoader
|
ClassLoaderServiceImpl(Collection<ClassLoader> providedClassLoaders)
Constructs a ClassLoaderServiceImpl with the given ClassLoader instances
|
Modifier and Type | Method and Description |
---|---|
<T> Class<T> |
classForName(String className)
Locate a class by name.
|
static ClassLoaderServiceImpl |
fromConfigSettings(Map configValues)
Deprecated.
No longer used/supported!
|
<S> LinkedHashSet<S> |
loadJavaServices(Class<S> serviceContract)
Discovers and instantiates implementations of the named service contract.
|
URL |
locateResource(String name)
Locate a resource by name (classpath lookup).
|
List<URL> |
locateResources(String name)
Locate a series of resource by name (classpath lookup).
|
InputStream |
locateResourceStream(String name)
Locate a resource by name (classpath lookup) and gets its stream.
|
void |
stop()
Stop phase notification
|
<T> T |
withTccl(ClassLoaderServiceImpl.Work<T> work)
Perform some discrete work with with the TCCL set to our aggregated ClassLoader
|
public ClassLoaderServiceImpl()
public ClassLoaderServiceImpl(ClassLoader classLoader)
classLoader
- The ClassLoader to usepublic ClassLoaderServiceImpl(Collection<ClassLoader> providedClassLoaders)
providedClassLoaders
- The ClassLoader instances to use@Deprecated public static ClassLoaderServiceImpl fromConfigSettings(Map configValues)
configValues
- The config valuespublic <T> Class<T> classForName(String className)
ClassLoaderService
classForName
in interface ClassLoaderService
T
- The returned class type.className
- The name of the class to locatepublic URL locateResource(String name)
ClassLoaderService
locateResource
in interface ClassLoaderService
name
- The resource name.null
to indicate the resource was not foundpublic InputStream locateResourceStream(String name)
ClassLoaderService
locateResourceStream
in interface ClassLoaderService
name
- The resource name.null
to indicate the resource was not foundpublic List<URL> locateResources(String name)
ClassLoaderService
locateResources
in interface ClassLoaderService
name
- The resource name.null
to indicate the resource was not foundpublic <S> LinkedHashSet<S> loadJavaServices(Class<S> serviceContract)
ClassLoaderService
Service
. Instead here we are talking about
services as defined by ServiceLoader
.loadJavaServices
in interface ClassLoaderService
S
- The type of the service contractserviceContract
- The java type defining the service contractpublic void stop()
Stoppable
public <T> T withTccl(ClassLoaderServiceImpl.Work<T> work)
T
- The type of the work resultwork
- The discrete work to be doneCopyright © 2001-2015 Red Hat, Inc. All Rights Reserved.