Class ClassLoaderServiceImpl
java.lang.Object
org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl
- All Implemented Interfaces:
Serializable,ClassLoaderService,ResourceLocator,ResourceStreamLocator,Service,Stoppable
Standard implementation of the service for interacting with class loaders
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hibernate.boot.registry.classloading.spi.ClassLoaderService
ClassLoaderService.Work<T> -
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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
Modifier and TypeMethodDescription<T> Class<T> classForName(String className) Locate a class by name.<T> TgenerateProxy(InvocationHandler handler, Class<?>... interfaces) <S> Collection<S> loadJavaServices(Class<S> serviceContract) Discovers and instantiates implementations of the named service contract.locateResource(String name) Locate a resource by name (classpath lookup).locateResources(String name) Locate a series of resource by name (classpath lookup).locateResourceStream(String name) Locate a resource by name (classpath lookup) and gets its stream.packageForNameOrNull(String packageName) Loading a Package from the ClassLoader.voidstop()Stop phase notification<T> TMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.boot.registry.classloading.spi.ClassLoaderService
classForTypeName
-
Constructor Details
-
ClassLoaderServiceImpl
public ClassLoaderServiceImpl()Constructs a ClassLoaderServiceImpl with standard set-up -
ClassLoaderServiceImpl
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 Details
-
classForName
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
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
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
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
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:
-
generateProxy
- Specified by:
generateProxyin interfaceClassLoaderService
-
packageForNameOrNull
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
- Specified by:
workWithClassLoaderin interfaceClassLoaderService
-
stop
public void stop()Description copied from interface:StoppableStop phase notification
-