public <T> List<Class<T>> getInterfaceImplementations(Class<T> interfaceClass, File f) throws IOException, ClassNotFoundException {
    ArrayList<Class<T>> list = new ArrayList<>();
    List<String> classes = null;
    if (f.isDirectory()) {
      classes = getClassesFromDir(f);
    } else {
      classes = getClassesFromJar(f);
    }
    URL url = f.toURI().toURL();
    ClassLoader cl = new URLClassLoader(new URL[]{ url }, this.getClass().getClassLoader());
    for (String klazz : classes) {
      try {
        Class<?> c = cl.loadClass(klazz);
        if (interfaceClass.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
          list.add((Class<T>) c);
        }
      } catch (Throwable t) {
        LOGGER.warn(String.format("Error checking if class %s from file %s is implementing %s: %s", klazz, f, interfaceClass.getName(), t.getMessage()));
      }
    }
    return list;

  }
Load classes (interface implementation) from directory.

@param <T>
@param dir  dir with classes, zip or jar's
@param type interface to load
@return
olv-core/src/main/java/pl/otros/logview/api/BaseLoader.java