@Override
public Iterable<? extends FileDescriptor> scan(InputStream item, String path, Scope scope, Scanner scanner) throws IOException {
Matcher matcher = PATTERN.matcher(path);
if (matcher.matches()) {
String serviceInterface = matcher.group(2);
ServiceLoaderDescriptor serviceLoaderDescriptor = getStore().create(ServiceLoaderDescriptor.class);
TypeDescriptor interfaceTypeDescriptor = getTypeDescriptor(serviceInterface);
serviceLoaderDescriptor.setType(interfaceTypeDescriptor);
BufferedReader reader = new BufferedReader(new InputStreamReader(item));
String serviceImplementation;
while ((serviceImplementation = reader.readLine()) != null) {
TypeDescriptor implementationTypeDescriptor = getTypeDescriptor(serviceImplementation);
serviceLoaderDescriptor.getContains().add(implementationTypeDescriptor);
}
serviceLoaderDescriptor.setFileName(path);
return asList(serviceLoaderDescriptor);
}
return emptyList();
}