Class ResourcePathClassLoader


  • public class ResourcePathClassLoader
    extends java.lang.ClassLoader
    Loads classes and resources from a configurable set of places. Well-known local directories and/or contents of the executed jar file are used as fall-back resourcePaths.
    • Constructor Summary

      Constructors 
      Constructor Description
      ResourcePathClassLoader​(java.util.Properties settings)
      Creates a new class loader initializing itself with the specified settings.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Class<?> findClass​(java.lang.String name)  
      protected java.net.URL findResource​(java.lang.String name)
      Finds the resource with the given name.
      java.util.Collection<java.net.URL> getPaths()
      Returns the resource paths this loader operates on.
      protected static java.net.URL getResource​(java.lang.String aName, java.util.Collection<java.net.URL> resourcePaths)
      Finds the resource with the given name in the given resource paths.
      • Methods inherited from class java.lang.ClassLoader

        clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
      • Methods inherited from class java.lang.Object

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

      • ResourcePathClassLoader

        public ResourcePathClassLoader​(java.util.Properties settings)
        Creates a new class loader initializing itself with the specified settings.
    • Method Detail

      • getPaths

        public java.util.Collection<java.net.URL> getPaths()
        Returns the resource paths this loader operates on.
      • findResource

        protected java.net.URL findResource​(java.lang.String name)
        Finds the resource with the given name.
        Overrides:
        findResource in class java.lang.ClassLoader
        Parameters:
        name - the resource name
        Returns:
        a URL for reading the resource, or null if the resource could not be found
        See Also:
        ClassLoader.findResource(String)
      • getResource

        protected static java.net.URL getResource​(java.lang.String aName,
                                                  java.util.Collection<java.net.URL> resourcePaths)
        Finds the resource with the given name in the given resource paths.
        Parameters:
        aName - The resource name, a relative path!
        resourcePaths - Additional resource paths to find the resource in
        Returns:
        A URL for reading the resource, or null if the resource could not be found
      • findClass

        protected java.lang.Class<?> findClass​(java.lang.String name)
                                        throws java.lang.ClassNotFoundException
        Overrides:
        findClass in class java.lang.ClassLoader
        Throws:
        java.lang.ClassNotFoundException
        See Also:
        ClassLoader.findClass(java.lang.String)