Class WMUrlClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- com.wavemaker.commons.classloader.WMUrlClassLoader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class WMUrlClassLoader extends java.net.URLClassLoader
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWMUrlClassLoader.CompoundEnumeration<E>
-
Constructor Summary
Constructors Constructor Description WMUrlClassLoader(java.net.URL[] urls, java.lang.String loaderContext)WMUrlClassLoader(java.net.URL[] urls, java.lang.String loaderContext, java.lang.ClassLoader parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.URLgetResource(java.lang.String name)If we want to load a resource and it is available in both the parent classloader and the child classloader, then the default behaviour is, first it will check in the parent classloader if it not found then it will check in the child classloader.java.util.Enumeration<java.net.URL>getResources(java.lang.String name)java.lang.StringtoString()-
Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getResource
public java.net.URL getResource(java.lang.String name)
If we want to load a resource and it is available in both the parent classloader and the child classloader, then the default behaviour is, first it will check in the parent classloader if it not found then it will check in the child classloader. So if we want to load the this type resource, we will always get the resource from the parent classloader, child's resource will never get loaded. To solve this first we are checking in the child classloader, if it is not found then checking in the parent classloader.- Overrides:
getResourcein classjava.lang.ClassLoader- 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
public java.util.Enumeration<java.net.URL> getResources(java.lang.String name) throws java.io.IOException- Overrides:
getResourcesin classjava.lang.ClassLoader- Throws:
java.io.IOException
-
-