Search in sources :

Example 1 with ClassPathScanner

use of org.flywaydb.core.internal.scanner.classpath.ClassPathScanner in project flyway by flyway.

the class ClasspathClassScanner method scanForType.

public List<String> scanForType(String location, Class<?> classType, boolean errorOnNotFound) {
    ClassPathScanner<?> s = new ClassPathScanner<>(classType, classLoader, Charset.defaultCharset(), new Location("classpath:" + location), resourceNameCache, locationScannerCache, errorOnNotFound);
    List<String> discoveredTypes = new ArrayList<>();
    for (LoadableResource resource : s.scanForResources()) {
        if (resource.getAbsolutePath().endsWith(".class")) {
            discoveredTypes.add(toClassName(resource.getAbsolutePath()));
        }
    }
    return discoveredTypes;
}
Also used : ArrayList(java.util.ArrayList) LoadableResource(org.flywaydb.core.api.resource.LoadableResource) ClassPathScanner(org.flywaydb.core.internal.scanner.classpath.ClassPathScanner) Location(org.flywaydb.core.api.Location)

Aggregations

ArrayList (java.util.ArrayList)1 Location (org.flywaydb.core.api.Location)1 LoadableResource (org.flywaydb.core.api.resource.LoadableResource)1 ClassPathScanner (org.flywaydb.core.internal.scanner.classpath.ClassPathScanner)1