Package org.apache.lucene.util
Class ModuleResourceLoader
- java.lang.Object
-
- org.apache.lucene.util.ModuleResourceLoader
-
- All Implemented Interfaces:
ResourceLoader
public final class ModuleResourceLoader extends java.lang.Object implements ResourceLoader
SimpleResourceLoader
that usesModule.getResourceAsStream(String)
andClass.forName(Module,String)
to open resources and classes, respectively. Resource paths must be absolute to module's root.To use this class, you must open the module to the
org.apache.lucene.core
module, otherwise resources can't be looked up.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Module
module
-
Constructor Summary
Constructors Constructor Description ModuleResourceLoader(java.lang.Module module)
Creates an instance using the given Java Module to load resources and classes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> java.lang.Class<? extends T>
findClass(java.lang.String cname, java.lang.Class<T> expectedType)
Finds class of the name and expected typejava.io.InputStream
openResource(java.lang.String resource)
Opens a named resource-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.ResourceLoader
newInstance
-
-
-
-
Method Detail
-
openResource
public java.io.InputStream openResource(java.lang.String resource) throws java.io.IOException
Description copied from interface:ResourceLoader
Opens a named resource- Specified by:
openResource
in interfaceResourceLoader
- Throws:
java.io.IOException
-
findClass
public <T> java.lang.Class<? extends T> findClass(java.lang.String cname, java.lang.Class<T> expectedType)
Description copied from interface:ResourceLoader
Finds class of the name and expected type- Specified by:
findClass
in interfaceResourceLoader
-
-