Code example for Hashtable

Methods: get, put

0
 
  public Class findClass(String className){
    System.out.println("Finding class " + className);
    byte classByte[];
    Class result=null;
    result = (Class)classes.get(className);
    if(result != null){
      return result;
    } 
 
    // Get it ourselves before the system classloader. 
    try{ 
      classByte = loadClassData("classes/test/data/CustomClassLoader2/" + className.replace('.',File.separatorChar)+".class");
      System.out.println("Defining class " + className);
      result = defineClass(className,classByte,0,classByte.length,null);
      System.out.println("Registering class " + className);
      classes.put(className,result);
      System.out.println("Found class. Returning.");
      return result;
    } catch(Exception e){
      System.out.println("Couldn't get the class ourselves!");
    }