@Override
  public Class findClass(String name) throws ClassNotFoundException {

    Class cls = loadedClasses.get(name);

    if (cls != null) {
      return cls;
    }

    for (ClassConstruct clazz : classes) {
      if (clazz.getDottedName().equals(name)) {
        return load(clazz);
      }
    }

    throw new ClassNotFoundException(name);
  }
 private Class load(ClassConstruct clazz) {
   byte[] bytecode = clazz.generateBytes();
   Class loadedClass = defineClass(clazz.getDottedName(), bytecode, 0, bytecode.length);
   loadedClasses.put(clazz.getDottedName(), loadedClass);
   return loadedClass;
 }
 public void loadAll() throws ClassNotFoundException {
   for (ClassConstruct clazz : classes) {
     findClass(clazz.getDottedName());
   }
 }