private static void checkDirectory(File directory, String pkgname,
            List<Class<?>> classes) {
        if (!directory.exists() || !directory.isDirectory()) {
            return;
        }

        for (String fileName : directory.list()) {
            if (!fileName.endsWith(".class")) {
                checkDirectory(new File(directory, fileName),
                        pkgname + '.' + fileName, classes);
            } else {
                classes.add(loadClass(pkgname + '.' + fileName.substring(0,
                        fileName.length() - 6)));
            }
        }
    }