@Test public void getClasses() throws Exception { Class[] classes = serviceLocator.findClasses(ChangeLogParser.class); assertTrue(classes.length > 0); }
public Class[] findClasses(Class requiredInterface) throws ServiceNotFoundException { logger.debug("ServiceLocator.findClasses for "+requiredInterface.getName()); try { Class.forName(requiredInterface.getName()); if (!classesBySuperclass.containsKey(requiredInterface)) { classesBySuperclass.put(requiredInterface, findClassesImpl(requiredInterface)); } } catch (Exception e) { throw new ServiceNotFoundException(e); } List<Class> classes = classesBySuperclass.get(requiredInterface); HashSet<Class> uniqueClasses = new HashSet<Class>(classes); return uniqueClasses.toArray(new Class[uniqueClasses.size()]); }
ServiceLocator { public Class[] findClasses(Class requiredInterface) throws ServiceNotFoundException { logger.debug("ServiceLocator.findClasses for "+requiredInterface.getName()); try { Class.forName(requiredInterface.getName()); if (!classesBySuperclass.containsKey(requiredInterface)) { classesBySuperclass.put(requiredInterface, findClassesImpl(requiredInterface)); } } catch (Exception e) { throw new ServiceNotFoundException(e); } List<Class> classes = classesBySuperclass.get(requiredInterface); HashSet<Class> uniqueClasses = new HashSet<Class>(classes); return uniqueClasses.toArray(new Class[uniqueClasses.size()]); } }
ServiceLocator { public Class[] findClasses(Class requiredInterface) throws ServiceNotFoundException { logger.debug("ServiceLocator.findClasses for "+requiredInterface.getName()); try { Class.forName(requiredInterface.getName()); if (!classesBySuperclass.containsKey(requiredInterface)) { classesBySuperclass.put(requiredInterface, findClassesImpl(requiredInterface)); } } catch (Exception e) { throw new ServiceNotFoundException(e); } List<Class> classes = classesBySuperclass.get(requiredInterface); HashSet<Class> uniqueClasses = new HashSet<Class>(classes); return uniqueClasses.toArray(new Class[uniqueClasses.size()]); } protected  ServiceLocator(); protected  ServiceLocator(ResourceAccessor accessor); protected  ServiceLocator(PackageScanClassResolver classResolver); protected  ServiceLocator(PackageScanClassResolver classResolver, ResourceAccessor accessor); }
ServiceLocator { public Class[] findClasses(Class requiredInterface) throws ServiceNotFoundException { logger.debug("ServiceLocator.findClasses for "+requiredInterface.getName()); try { Class.forName(requiredInterface.getName()); if (!classesBySuperclass.containsKey(requiredInterface)) { classesBySuperclass.put(requiredInterface, findClassesImpl(requiredInterface)); } } catch (Exception e) { throw new ServiceNotFoundException(e); } List<Class> classes = classesBySuperclass.get(requiredInterface); HashSet<Class> uniqueClasses = new HashSet<Class>(classes); return uniqueClasses.toArray(new Class[uniqueClasses.size()]); } protected  ServiceLocator(); protected  ServiceLocator(ResourceAccessor accessor); protected  ServiceLocator(PackageScanClassResolver classResolver); protected  ServiceLocator(PackageScanClassResolver classResolver, ResourceAccessor accessor); static ServiceLocator getInstance(); static void setInstance(ServiceLocator newInstance); void setResourceAccessor(ResourceAccessor resourceAccessor); void addPackageToScan(String packageName); Class findClass(Class requiredInterface); Class[] findClasses(Class requiredInterface); Object newInstance(Class requiredInterface); static void reset(); }
ServiceLocator { public Class[] findClasses(Class requiredInterface) throws ServiceNotFoundException { logger.debug("ServiceLocator.findClasses for "+requiredInterface.getName()); try { Class.forName(requiredInterface.getName()); if (!classesBySuperclass.containsKey(requiredInterface)) { classesBySuperclass.put(requiredInterface, findClassesImpl(requiredInterface)); } } catch (Exception e) { throw new ServiceNotFoundException(e); } List<Class> classes = classesBySuperclass.get(requiredInterface); HashSet<Class> uniqueClasses = new HashSet<Class>(classes); return uniqueClasses.toArray(new Class[uniqueClasses.size()]); } protected  ServiceLocator(); protected  ServiceLocator(ResourceAccessor accessor); protected  ServiceLocator(PackageScanClassResolver classResolver); protected  ServiceLocator(PackageScanClassResolver classResolver, ResourceAccessor accessor); static ServiceLocator getInstance(); static void setInstance(ServiceLocator newInstance); void setResourceAccessor(ResourceAccessor resourceAccessor); void addPackageToScan(String packageName); Class findClass(Class requiredInterface); Class[] findClasses(Class requiredInterface); Object newInstance(Class requiredInterface); static void reset();  }