Package org.apache.lucene.analysis.util
Class ClasspathResourceLoader
java.lang.Object
org.apache.lucene.analysis.util.ClasspathResourceLoader
- All Implemented Interfaces:
ResourceLoader
Simple
ResourceLoader that uses ClassLoader.getResourceAsStream(String)
and Class.forName(String,boolean,ClassLoader) to open resources and
classes, respectively.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionDeprecated.You should not use this ctor, because it uses the thread's context class loader, which is bad programming style.ClasspathResourceLoader(Class<?> clazz) Creates an instance using the context classloader to load Resources and classes Resources are resolved relative to the given class, if path is not absolute.privateClasspathResourceLoader(Class<?> clazz, ClassLoader loader) ClasspathResourceLoader(ClassLoader loader) Creates an instance using the given classloader to load Resources and classes. -
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
-
clazz
-
loader
-
-
Constructor Details
-
ClasspathResourceLoader
Deprecated.You should not use this ctor, because it uses the thread's context class loader, which is bad programming style. Please specify a reference class or aClassLoaderinstead.Creates an instance using the context classloader to load resources and classes. Resource paths must be absolute.- See Also:
-
ClasspathResourceLoader
Creates an instance using the given classloader to load Resources and classes. Resource paths must be absolute. -
ClasspathResourceLoader
Creates an instance using the context classloader to load Resources and classes Resources are resolved relative to the given class, if path is not absolute. -
ClasspathResourceLoader
-
-
Method Details
-
openResource
Description copied from interface:ResourceLoaderOpens a named resource- Specified by:
openResourcein interfaceResourceLoader- Throws:
IOException
-
findClass
Description copied from interface:ResourceLoaderFinds class of the name and expected type- Specified by:
findClassin interfaceResourceLoader
-
newInstance
Description copied from interface:ResourceLoaderCreates an instance of the name and expected type- Specified by:
newInstancein interfaceResourceLoader
-