/** * Get the names of interfaces on the classpath that extend a given superinterface. * * @param superInterface * The superinterface. * @return The sorted list of the names of subinterfaces of the given superinterface, or the empty list if none. */ public List<String> getNamesOfSubinterfacesOf(final Class<?> superInterface) { return getNamesOfSubinterfacesOf(scanSpec.getInterfaceName(superInterface)); }
private List<String> findInterfacesExtendingInterface(Class<?> clazz) { List<String> result = Collections.emptyList(); if (isInterface(clazz)) { result = scanCache.getNamesOfSubinterfacesOf(clazz); } return result; }
@Override public void lookForMatches(final ScanResult scanResult, final LogNode log) { final String superinterfaceName = getInterfaceName(superinterface); for (final String subinterfaceName : scanResult.getNamesOfSubinterfacesOf(superinterfaceName)) { LogNode subLog = null; if (log != null) { subLog = log.log("Matched subinterface of " + superinterfaceName + ": " + subinterfaceName); } try { // Call classloader @SuppressWarnings("unchecked") final Class<? extends T> cls = (Class<? extends T>) loadClassForMatchProcessor( subinterfaceName, scanResult, log); // Process match if (cls != null) { subinterfaceMatchProcessor.processMatch(cls); } } catch (final Throwable e) { if (subLog != null) { subLog.log("Exception while processing match for class " + subinterfaceName, e); } scanResult.addMatchProcessorException(e); } } } });