Class FilesystemResourceLoader
- All Implemented Interfaces:
ResourceLoader
ResourceLoader that opens resource files from the local file system, optionally
resolving against a base directory.
This loader wraps a delegate ResourceLoader that is used to resolve all files, the
current base directory does not contain. newInstance(java.lang.String, java.lang.Class<T>) is always resolved against the
delegate, as a ClassLoader is needed.
You can chain several FilesystemResourceLoaders to allow lookup of files in more than
one base directory.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFilesystemResourceLoader(Path baseDirectory, ClassLoader delegate) Creates a resource loader that resolves resources against the given base directory.FilesystemResourceLoader(Path baseDirectory, Module delegate) Creates a resource loader that resolves resources against the given base directory.FilesystemResourceLoader(Path baseDirectory, ResourceLoader delegate) Creates a resource loader that resolves resources against the given base directory. -
Method Summary
Modifier and TypeMethodDescription<T> Class<? extends T> Finds class of the name and expected type<T> TnewInstance(String cname, Class<T> expectedType) Creates an instance of the name and expected typeopenResource(String resource) Opens a named resource
-
Field Details
-
baseDirectory
-
delegate
-
-
Constructor Details
-
FilesystemResourceLoader
Creates a resource loader that resolves resources against the given base directory. Files not found in file system and class lookups are delegated toClassLoader.To use this constructor with the Java Module System, you must open all modules that contain resources to the
org.apache.lucene.coremodule, otherwise resources can't be looked up. It is recommended to useFilesystemResourceLoader(Path, Module)for such use cases as this would limit to certain modules. -
FilesystemResourceLoader
Creates a resource loader that resolves resources against the given base directory. Files not found in file system and class lookups are delegated toModuleResourceLoader.To use this constructor, you must open the module to the
org.apache.lucene.coremodule, otherwise resources can't be looked up. -
FilesystemResourceLoader
Creates a resource loader that resolves resources against the given base directory. Files not found in file system and class lookups are delegated to the given delegateResourceLoader.
-
-
Method Details
-
openResource
Description copied from interface:ResourceLoaderOpens a named resource- Specified by:
openResourcein interfaceResourceLoader- Throws:
IOException
-
newInstance
Description copied from interface:ResourceLoaderCreates an instance of the name and expected type- Specified by:
newInstancein interfaceResourceLoader
-
findClass
Description copied from interface:ResourceLoaderFinds class of the name and expected type- Specified by:
findClassin interfaceResourceLoader
-