Interface ChildClassLoader

All Known Implementing Classes:
ChildURLClassLoader

public interface ChildClassLoader
Defines the interface of a child class loader, mixed from ClassLoader and java.net.URLClassLoader.
Author:
Holger Eichelberger, SSE
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Sets the default assertion status for this class loader to false and discards any package defaults or class assertion status settings associated with the class loader.
    Finds and loads the class with the specified name from the URL search path.
    Finds the resource with the given name.
    Returns an input stream for reading the specified resource.
    Finds all the resources with the given name.
    void
    setClassAssertionStatus(String className, boolean enabled)
    Sets the desired assertion status for the named top-level class in this class loader and any nested classes contained therein.
    void
    setDefaultAssertionStatus(boolean enabled)
    Sets the default assertion status for this class loader.
    void
    setPackageAssertionStatus(String packageName, boolean enabled)
    Sets the package default assertion status for the named package.
  • Method Details

    • findClass

      Class<?> findClass(String name) throws ClassNotFoundException
      Finds and loads the class with the specified name from the URL search path. Any URLs referring to JAR files are loaded and opened as needed until the class is found.
      Parameters:
      name - the name of the class
      Returns:
      the resulting class
      Throws:
      ClassNotFoundException - if the class could not be found, or if the loader is closed.
      NullPointerException - if name is null
    • getResource

      URL getResource(String name)
      Finds the resource with the given name. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.
      Parameters:
      name - The resource name
      Returns:
      A URL object for reading the resource, or null if the resource could not be found or the invoker doesn't have adequate privileges to get the resource.
    • getResources

      Enumeration<URL> getResources(String name) throws IOException
      Finds all the resources with the given name. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.
      Parameters:
      name - The resource name
      Returns:
      An enumeration of URL objects for the resource. If no resources could be found, the enumeration will be empty. Resources that the class loader doesn't have access to will not be in the enumeration.
      Throws:
      IOException - If I/O errors occur
    • getResourceAsStream

      InputStream getResourceAsStream(String name)
      Returns an input stream for reading the specified resource.
      Parameters:
      name - The resource name
      Returns:
      An input stream for reading the resource, or null if the resource could not be found
    • setClassAssertionStatus

      void setClassAssertionStatus(String className, boolean enabled)
      Sets the desired assertion status for the named top-level class in this class loader and any nested classes contained therein. This setting takes precedence over the class loader's default assertion status, and over any applicable per-package default. This method has no effect if the named class has already been initialized. (Once a class is initialized, its assertion status cannot change.)
      Parameters:
      className - The fully qualified class name of the top-level class whose assertion status is to be set.
      enabled - true if the named class is to have assertions enabled when (and if) it is initialized, false if the class is to have assertions disabled.
    • clearAssertionStatus

      void clearAssertionStatus()
      Sets the default assertion status for this class loader to false and discards any package defaults or class assertion status settings associated with the class loader. This method is provided so that class loaders can be made to ignore any command line or persistent assertion status settings and "start with a clean slate."
    • setDefaultAssertionStatus

      void setDefaultAssertionStatus(boolean enabled)
      Sets the default assertion status for this class loader. This setting determines whether classes loaded by this class loader and initialized in the future will have assertions enabled or disabled by default.
      Parameters:
      enabled - true if classes loaded by this class loader will henceforth have assertions enabled by default, false if they will have assertions disabled by default.
    • setPackageAssertionStatus

      void setPackageAssertionStatus(String packageName, boolean enabled)
      Sets the package default assertion status for the named package. The package default assertion status determines the assertion status for classes initialized in the future that belong to the named package or any of its "subpackages".
      Parameters:
      packageName - The name of the package whose package default assertion status is to be set. A null value indicates the unnamed package that is "current"
      enabled - true if classes loaded by this classloader and belonging to the named package or any of its subpackages will have assertions enabled by default, false if they will have assertions disabled by default.