Package sonia.scm.net

Class ChildFirstURLClassLoader

All Implemented Interfaces:
Closeable, AutoCloseable

public class ChildFirstURLClassLoader extends URLClassLoader
The ChildFirstURLClassLoader alters regular ClassLoader delegation and will check the URLs used in its initialization for matching classes before delegating to its parent. Sometimes also referred to as a ParentLastClassLoader.
Since:
1.29
  • Constructor Details

    • ChildFirstURLClassLoader

      public ChildFirstURLClassLoader(URL[] urls)
      Constructs a new ChildFirstURLClassLoader for the specified URLs using the default delegation parent ClassLoader.
      Parameters:
      urls - the URLs from which to load classes and resources
    • ChildFirstURLClassLoader

      public ChildFirstURLClassLoader(URL[] urls, ClassLoader parent)
      Constructs a new ChildFirstURLClassLoader for the specified URLs using the given parent ClassLoader for delegation.
      Parameters:
      urls - the URLs from which to load classes and resources
      parent - the parent class loader for delegation
    • ChildFirstURLClassLoader

      public ChildFirstURLClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)
      Constructs a new URLClassLoader for the specified URLs, parent class loader, and URLStreamHandlerFactory. The parent argument will be used as the parent class loader for delegation. The factory argument will be used as the stream handler factory to obtain protocol handlers when creating new URLs.
      Parameters:
      urls - the URLs from which to load classes and resources
      parent - the parent class loader for delegation
      factory - the URLStreamHandlerFactory to use when creating URLs
  • Method Details