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
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> T
generateProxy
(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.void
stop()
Stop phase notification<T> T
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 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:ClassLoaderService
Locate a class by name.- Specified by:
classForName
in 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:ClassLoaderService
Locate a resource by name (classpath lookup).- Specified by:
locateResource
in interfaceClassLoaderService
- Specified by:
locateResource
in interfaceResourceLocator
- Parameters:
name
- The resource name.- Returns:
- The located URL; may return
null
to indicate the resource was not found
-
locateResourceStream
Description copied from interface:ClassLoaderService
Locate a resource by name (classpath lookup) and gets its stream.- Specified by:
locateResourceStream
in interfaceClassLoaderService
- Specified by:
locateResourceStream
in interfaceResourceStreamLocator
- Parameters:
name
- The resource name.- Returns:
- The stream of the located resource; may return
null
to indicate the resource was not found
-
locateResources
Description copied from interface:ClassLoaderService
Locate a series of resource by name (classpath lookup).- Specified by:
locateResources
in interfaceClassLoaderService
- Parameters:
name
- The resource name.- Returns:
- The list of URL matching; may return
null
to indicate the resource was not found
-
loadJavaServices
Description copied from interface:ClassLoaderService
Discovers and instantiates implementations of the named service contract.- Specified by:
loadJavaServices
in 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:
generateProxy
in interfaceClassLoaderService
-
packageForNameOrNull
Description copied from interface:ClassLoaderService
Loading a Package from the ClassLoader.- Specified by:
packageForNameOrNull
in interfaceClassLoaderService
- Returns:
- The Package.
null
if no such Package is found, or if the ClassLoader call leads to an exception (LinkageError
, e.g.).
-
workWithClassLoader
- Specified by:
workWithClassLoader
in interfaceClassLoaderService
-
stop
public void stop()Description copied from interface:Stoppable
Stop phase notification
-