class ClasspathResourceIndex implements ResourceIndex {

    @Override
    public Iterable<Resource> list(String path, String suffix) {
        String classpath = path.replace("classpath:", "");
        ResourceIteratorFactory resourceIteratorFactory = new DelegatingResourceIteratorFactory();

        try {
            Enumeration<URL> resources = classLoader.getResources(classpath);

            return enumerationStream(resources)
                    .map(url -> resourceIteratorFactory.createIterator(url, classpath, suffix))
                    .flatMap(ClasspathResourceIndex::iteratorStream)
                    .collect(toList());

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public  ClasspathResourceIndex(ClassLoader classLoader);

}