Class ClassLoaderServiceImpl
- java.lang.Object
-
- org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl
-
- All Implemented Interfaces:
Serializable,ClassLoaderService,ResourceLocator,ResourceStreamLocator,Service,Stoppable
- Direct Known Subclasses:
ClassLoaderServiceTestingImpl,ExtraJavaServicesClassLoaderService
public class ClassLoaderServiceImpl extends Object implements ClassLoaderService
Standard implementation of the service for interacting with class loaders- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.boot.registry.classloading.spi.ClassLoaderService
ClassLoaderService.Work<T>
-
-
Constructor Summary
Constructors Constructor Description ClassLoaderServiceImpl()Constructs a ClassLoaderServiceImpl with standard set-upClassLoaderServiceImpl(ClassLoader classLoader)Constructs a ClassLoaderServiceImpl with the given ClassLoaderClassLoaderServiceImpl(Collection<ClassLoader> providedClassLoaders, TcclLookupPrecedence lookupPrecedence)Constructs a ClassLoaderServiceImpl with the given ClassLoader instances
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T> Class<T>classForName(String className)Locate a class by name.static ClassLoaderServiceImplfromConfigSettings(Map configValues)Deprecated.No longer used/supported!<T> TgenerateProxy(InvocationHandler handler, Class... interfaces)<S> Collection<S>loadJavaServices(Class<S> serviceContract)Discovers and instantiates implementations of the named service contract.URLlocateResource(String name)Locate a resource by name (classpath lookup).List<URL>locateResources(String name)Locate a series of resource by name (classpath lookup).InputStreamlocateResourceStream(String name)Locate a resource by name (classpath lookup) and gets its stream.PackagepackageForNameOrNull(String packageName)Loading a Package from the ClassLoader.voidstop()Stop phase notification<T> TworkWithClassLoader(ClassLoaderService.Work<T> work)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.boot.registry.classloading.spi.ClassLoaderService
classForTypeName
-
-
-
-
Constructor Detail
-
ClassLoaderServiceImpl
public ClassLoaderServiceImpl()
Constructs a ClassLoaderServiceImpl with standard set-up
-
ClassLoaderServiceImpl
public ClassLoaderServiceImpl(ClassLoader classLoader)
Constructs a ClassLoaderServiceImpl with the given ClassLoader- Parameters:
classLoader- The ClassLoader to use
-
ClassLoaderServiceImpl
public ClassLoaderServiceImpl(Collection<ClassLoader> providedClassLoaders, TcclLookupPrecedence lookupPrecedence)
Constructs a ClassLoaderServiceImpl with the given ClassLoader instances- Parameters:
providedClassLoaders- The ClassLoader instances to uselookupPrecedence- The lookup precedence of the thread contextClassLoader
-
-
Method Detail
-
fromConfigSettings
@Deprecated @Internal public static ClassLoaderServiceImpl fromConfigSettings(Map configValues)
Deprecated.No longer used/supported!No longer used/supported!- Parameters:
configValues- The config values- Returns:
- The built service
-
classForName
public <T> Class<T> classForName(String className)
Description copied from interface:ClassLoaderServiceLocate a class by name.- Specified by:
classForNamein interfaceClassLoaderService- Type Parameters:
T- The returned class type.- Parameters:
className- The name of the class to locate- Returns:
- The class reference
-
locateResource
public URL locateResource(String name)
Description copied from interface:ClassLoaderServiceLocate a resource by name (classpath lookup).- Specified by:
locateResourcein interfaceClassLoaderService- Specified by:
locateResourcein interfaceResourceLocator- Parameters:
name- The resource name.- Returns:
- The located URL; may return
nullto indicate the resource was not found
-
locateResourceStream
public InputStream locateResourceStream(String name)
Description copied from interface:ClassLoaderServiceLocate a resource by name (classpath lookup) and gets its stream.- Specified by:
locateResourceStreamin interfaceClassLoaderService- Specified by:
locateResourceStreamin interfaceResourceStreamLocator- Parameters:
name- The resource name.- Returns:
- The stream of the located resource; may return
nullto indicate the resource was not found
-
locateResources
public List<URL> locateResources(String name)
Description copied from interface:ClassLoaderServiceLocate a series of resource by name (classpath lookup).- Specified by:
locateResourcesin interfaceClassLoaderService- Parameters:
name- The resource name.- Returns:
- The list of URL matching; may return
nullto indicate the resource was not found
-
loadJavaServices
public <S> Collection<S> loadJavaServices(Class<S> serviceContract)
Description copied from interface:ClassLoaderServiceDiscovers and instantiates implementations of the named service contract.- Specified by:
loadJavaServicesin interfaceClassLoaderService- Type Parameters:
S- The type of the service contract- Parameters:
serviceContract- The java type defining the service contract- Returns:
- The ordered set of discovered services.
- See Also:
JavaServiceLoadable
-
generateProxy
public <T> T generateProxy(InvocationHandler handler, Class... interfaces)
- Specified by:
generateProxyin interfaceClassLoaderService
-
packageForNameOrNull
public Package packageForNameOrNull(String packageName)
Description copied from interface:ClassLoaderServiceLoading a Package from the ClassLoader.- Specified by:
packageForNameOrNullin interfaceClassLoaderService- Returns:
- The Package.
nullif no such Package is found, or if the ClassLoader call leads to an exception (LinkageError, e.g.).
-
workWithClassLoader
public <T> T workWithClassLoader(ClassLoaderService.Work<T> work)
- Specified by:
workWithClassLoaderin interfaceClassLoaderService
-
-