Class ModuleResourceLoader

  • All Implemented Interfaces:
    ResourceLoader

    public final class ModuleResourceLoader
    extends java.lang.Object
    implements ResourceLoader
    Simple ResourceLoader that uses Module.getResourceAsStream(String) and Class.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 type
      java.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
    • Field Detail

      • module

        private final java.lang.Module module
    • Constructor Detail

      • ModuleResourceLoader

        public ModuleResourceLoader​(java.lang.Module module)
        Creates an instance using the given Java Module to load resources and classes.
    • 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 interface ResourceLoader
        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 interface ResourceLoader