@SuppressWarnings({"unchecked"})
    public static <T> Class<? extends T>[] getClassesInPackageExtending(JarFile jarFile, String packageName, Class<T> sCls) throws ClassNotFoundException {
        notNull(jarFile, "JarFile jarFile");
        notNull(packageName, "String packageName");
        notEmpty(packageName, "String packageName");
        notNull(sCls, "Class<T> sCls");

        ArrayList<Class<? extends T>> classes = new ArrayList<Class<? extends T>>();
        Enumeration<JarEntry> entries = jarFile.entries();
        while (entries.hasMoreElements()) {
            JarEntry entry = entries.nextElement();
            String entName = entry.getName().replace("/", ".");
            if (entName.startsWith(packageName) && entName.endsWith(".class")) {
                Class<?> cls = Class.forName(entName.substring(0, entName.length() - 6));
                if (sCls.isAssignableFrom(cls)) {
                    classes.add(cls.asSubclass(sCls));
                }
            }
        }
        return classes.toArray(new Class[classes.size()]);
    }