com.veromodo.tempo.filters
Class JarClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by com.veromodo.tempo.filters.JarClassLoader

public class JarClassLoader
extends java.lang.ClassLoader

JarClassLoader: given a jar name, the constructor loads the class bytes from the jar file and the loadClass(classname) method returns the Class for that name


Constructor Summary
JarClassLoader(java.io.File jarFile)
           
JarClassLoader(java.lang.String jarName)
           
JarClassLoader(java.net.URL enURL, java.lang.ClassLoader pcl)
           
 
Method Summary
 java.lang.Class<?> loadClass(java.lang.String className)
          this implementation is a rewrite of the previous loadClass.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarClassLoader

public JarClassLoader(java.lang.String jarName)
               throws java.io.IOException
Throws:
java.io.IOException

JarClassLoader

public JarClassLoader(java.io.File jarFile)
               throws java.io.IOException
Throws:
java.io.IOException

JarClassLoader

public JarClassLoader(java.net.URL enURL,
                      java.lang.ClassLoader pcl)
               throws java.io.IOException,
                      java.net.URISyntaxException
Throws:
java.io.IOException
java.net.URISyntaxException
Method Detail

loadClass

public java.lang.Class<?> loadClass(java.lang.String className)
                             throws java.lang.ClassNotFoundException
this implementation is a rewrite of the previous loadClass. The logic is as follows: - If the class was already loaded, it will be in the cache. Pick up from there and return (the Class object) - Otherwise, get the bytes for the bytecode. - If we found the bytes, simply "define" the class, resolve it and add it to the cache - If it was not found, this is a class we know nothing about. Our Parent Class Loader should be queried. On the command-line, the PCL is simply picked up according to Java's semantics. In eclipse, though this does not work. The Parent() class loader is not the class loader of the code that invoked us. Instead, it is always the Eclipse classLoader (ugh). So... On eclipse, use the PCL that was explicitely given to us on creation. If PCL is not set, we are at the command line and the default getParent() classLoader will do fine.

Overrides:
loadClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException