public Class<?>[] scanForClasses(String location,Class<?> implementedInterface) throws Exception {
  LOG.debug("Scanning for classes at '" + location + "' (Implementing: '"+ implementedInterface.getName()+ "')");
  List<Class<?>> classes=new ArrayList<Class<?>>();
  Set<String> resourceNames=findResourceNames(location,"",".class");
  for (  String resourceName : resourceNames) {
    String className=toClassName(resourceName);
    Class<?> clazz=classLoader.loadClass(className);
    if (Modifier.isAbstract(clazz.getModifiers()) || clazz.isEnum() || clazz.isAnonymousClass()) {
      LOG.debug("Skipping non-instantiable class: " + className);
      continue;
    }
    if (!implementedInterface.isAssignableFrom(clazz)) {
      continue;
    }
    try {
      ClassUtils.instantiate(className,classLoader);
    }
 catch (    Exception e) {
      throw new CassandraMigrationException("Unable to instantiate class: " + className,e);
    }
    classes.add(clazz);
    LOG.debug("Found class: " + className);
  }
  return classes.toArray(new Class<?>[classes.size()]);
}

public Class < ? > [ ] scanForClasses ( String location , Class < ? > implementedInterface ) throws Exception { LOG . debug ( "Scanning for classes at '" + location + "' (Implementing: '" + implementedInterface . getName ( ) + "')" ) ; List < Class < ? > > classes = new ArrayList < Class < ? > > ( ) ; Set < String > resourceNames = findResourceNames ( location , "" , ".class" ) ; for ( String resourceName : resourceNames ) { String className = toClassName ( resourceName ) ; Class < ? > clazz = classLoader . loadClass ( className ) ; if ( Modifier . isAbstract ( clazz . getModifiers ( ) ) || clazz . isEnum ( ) || clazz . isAnonymousClass ( ) ) { LOG . debug ( "Skipping non-instantiable class: " + className ) ; continue ; } if ( ! implementedInterface . isAssignableFrom ( clazz ) ) { continue ; } try { ClassUtils . instantiate ( className , classLoader ) ; } catch ( Exception e ) { throw new CassandraMigrationException ( "Unable to instantiate class: " + className , e ) ; } classes . add ( clazz ) ; LOG . debug ( "Found class: " + className ) ; } return classes . toArray ( new Class < ? > [ classes . size ( ) ] ) ; }
scans the classpath for concrete classes under the specified package implementing this interface . non - instantiable abstract classes are filtered out .
