Class ClassClassPathResourceLoader
java.lang.Object
io.micronaut.core.io.scan.ClassClassPathResourceLoader
- All Implemented Interfaces:
ResourceLoader, ClassPathResourceLoader
@NullMarked
public class ClassClassPathResourceLoader
extends Object
implements ClassPathResourceLoader
A simple
ClassPathResourceLoader that uses a Class.- Since:
- 5.0
- Author:
- Denis Stepanov
-
Constructor Summary
ConstructorsConstructorDescriptionClassClassPathResourceLoader(Class<?> clazz) ClassClassPathResourceLoader(Class<?> clazz, String basePath) -
Method Summary
Modifier and TypeMethodDescriptionConstructs a new resource loader designed to load resources from the given path.Returns the underlying classloader used by thisClassPathResourceLoader.getResource(String path) Obtains the URL to a given resource.getResourceAsStream(String path) Obtains a resource as a stream.getResources(String name) Obtains all resources with the given name.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ClassPathResourceLoader
handleResourceDuplicates, supportsPrefixMethods inherited from interface ResourceLoader
reportResourceDuplicates
-
Constructor Details
-
ClassClassPathResourceLoader
-
ClassClassPathResourceLoader
-
-
Method Details
-
getClassLoader
Description copied from interface:ClassPathResourceLoaderReturns the underlying classloader used by thisClassPathResourceLoader.- Specified by:
getClassLoaderin interfaceClassPathResourceLoader- Returns:
- The underlying classloader used by this
ClassPathResourceLoader
-
getResourceAsStream
Description copied from interface:ResourceLoaderObtains a resource as a stream.- Specified by:
getResourceAsStreamin interfaceResourceLoader- Parameters:
path- The path- Returns:
- An optional resource
-
getResource
Description copied from interface:ResourceLoaderObtains the URL to a given resource.- Specified by:
getResourcein interfaceResourceLoader- Parameters:
path- The path- Returns:
- An optional resource
-
getResources
Description copied from interface:ResourceLoaderObtains all resources with the given name.- Specified by:
getResourcesin interfaceResourceLoader- Parameters:
name- The name of the resource- Returns:
- A stream of URLs
-
forBase
Description copied from interface:ResourceLoaderConstructs a new resource loader designed to load resources from the given path. Requested resources will be loaded within the context of the given path.- Specified by:
forBasein interfaceResourceLoader- Parameters:
basePath- The path to load resources- Returns:
- The new
ResourceLoader
-