Class ClassSubPathResourceLoader

  • All Implemented Interfaces:
    org.apache.lucene.util.ResourceLoader

    public class ClassSubPathResourceLoader
    extends java.lang.Object
    implements org.apache.lucene.util.ResourceLoader
    • Constructor Summary

      Constructors 
      Constructor Description
      ClassSubPathResourceLoader​(java.lang.ClassLoader loader, java.lang.String subpath)
      Creates an instance using the given classloader 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)  
      <T> T newInstance​(java.lang.String cname, java.lang.Class<T> expectedType)  
      java.io.InputStream openResource​(java.lang.String resource)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClassSubPathResourceLoader

        public ClassSubPathResourceLoader​(java.lang.ClassLoader loader,
                                          java.lang.String subpath)
        Creates an instance using the given classloader to load Resources and classes. Resource loading will be restricted to a portion of the classpath determined by prepending the specified sub-path. Class find/load still uses the full classpath.
        Parameters:
        loader - the class loader to use
        subpath - the subpath within the classpath to load resources from
    • Method Detail

      • openResource

        public java.io.InputStream openResource​(java.lang.String resource)
                                         throws java.io.IOException
        Specified by:
        openResource in interface org.apache.lucene.util.ResourceLoader
        Throws:
        java.io.IOException
      • findClass

        public <T> java.lang.Class<? extends T> findClass​(java.lang.String cname,
                                                          java.lang.Class<T> expectedType)
        Specified by:
        findClass in interface org.apache.lucene.util.ResourceLoader
      • newInstance

        public <T> T newInstance​(java.lang.String cname,
                                 java.lang.Class<T> expectedType)
        Specified by:
        newInstance in interface org.apache.lucene.util.ResourceLoader