private static void findInJar(String packageName, JarFile jar,
			ClassNameFilter nameFilter, Set<Class<?>> classes, boolean recursive)
			throws IOException, ClassNotFoundException {

		ClassNameFilter filter = nameFilter;
		if (filter == null) {
			filter = new ClassNameFilter() {
				@Override
				public boolean accept(String name) {
					return true;
				}
			};
		}

		Enumeration<JarEntry> entries = jar.entries();
		String className = null;
		while (entries.hasMoreElements()) {
			JarEntry entry = entries.nextElement();
			String name = entry.getName();
			if (!name.startsWith(packageName)) {
				LOG.debug(name + "not start with" + packageName);
				continue;
			}
			if (!name.endsWith(".class") || name.contains("$")) {
				LOG.debug("Not a class or an inner class");
				continue;
			}
			if (!recursive && name.lastIndexOf('/') != packageName.length()) {
				LOG.debug("Not recursive");
				continue;
			}
			if (!filter.accept(name)) {
				LOG.debug("NameFilter does not accept");
				continue;
			}

			className = name.replace("/", ".");
			className = className.substring(0, className.length() - 6);
			classes.add(Thread.currentThread()  
                     .getContextClassLoader().loadClass(className)); 
		}

	}