1 29 30 package com.caucho.bytecode; 31 32 import com.caucho.util.L10N; 33 34 import java.net.URL ; 35 import java.util.logging.Logger ; 36 37 40 public class JavaClassLoader extends JClassLoader { 41 protected static final L10N L = new L10N(JavaClassLoader.class); 42 protected static final Logger log = 43 Logger.getLogger(JavaClassLoader.class.getName()); 44 45 private ClassLoader _loader; 46 47 public JavaClassLoader() 48 { 49 this(Thread.currentThread().getContextClassLoader()); 50 } 51 52 public JavaClassLoader(ClassLoader loader) 53 { 54 _loader = loader; 55 } 56 57 60 protected JClass loadClass(String name) 61 { 62 if (name.startsWith("java")) { 63 return getStaticClassLoader().forName(name); 64 } 65 66 String classPath = name.replace('.', '/') + ".class"; 67 URL url = _loader.getResource(classPath); 68 69 if (url != null) { 70 JavaClass jClass = new JavaClass(this); 71 jClass.setURL(url); 72 73 jClass.setThisClass(name.replace('.', '/')); 74 75 return jClass; 76 } 77 78 return null; 79 } 80 81 84 protected JType parseParameterizedType(String type) 85 { 86 return new TypeSignatureParser(this, type).nextType(); 87 } 88 89 public String toString() 90 { 91 return "JavaClassLoader[]"; 92 } 93 } 94 | Popular Tags |