1 22 package org.jboss.util.loading; 23 24 import java.net.URL ; 25 import java.net.URLClassLoader ; 26 import java.net.URLStreamHandlerFactory ; 27 28 39 public class DelegatingClassLoader 40 extends URLClassLoader 41 { 42 43 public static final URL [] EMPTY_URL_ARRAY = {}; 44 45 46 protected boolean standard = false; 47 48 53 public DelegatingClassLoader(ClassLoader parent) 54 { 55 super(EMPTY_URL_ARRAY, parent); 56 if (parent == null) 57 throw new IllegalArgumentException ("No parent"); 58 } 59 60 66 public DelegatingClassLoader(ClassLoader parent, URLStreamHandlerFactory factory) 67 { 68 super(EMPTY_URL_ARRAY, parent, factory); 69 if (parent == null) 70 throw new IllegalArgumentException ("No parent"); 71 } 72 73 81 protected Class loadClass(String className, boolean resolve) 82 throws ClassNotFoundException 83 { 84 if (standard) 86 return super.loadClass(className, resolve); 87 88 Class clazz = getParent().loadClass(className); 90 91 if (resolve) 93 resolveClass(clazz); 94 95 return clazz; 96 } 97 } 98 | Popular Tags |