Search in sources :

Example 11 with IndexView

use of org.jboss.jandex.IndexView in project sts4 by spring-projects.

the class JandexIndex method allSubtypesOf.

public Flux<IType> allSubtypesOf(IType type) {
    DotName name = DotName.createSimple(type.getFullyQualifiedName());
    Flux<IType> flux = Flux.fromIterable(index.keySet()).publishOn(Schedulers.parallel()).flatMap(file -> {
        Optional<IndexView> optional = index.get(file).get();
        if (optional.isPresent()) {
            return Flux.fromIterable(type.isInterface() ? optional.get().getAllKnownImplementors(name) : optional.get().getAllKnownSubclasses(name)).publishOn(Schedulers.parallel()).map(info -> createType(Tuples.of(file, info)));
        } else {
            return Flux.empty();
        }
    });
    if (baseIndex == null) {
        return flux;
    } else {
        return Flux.merge(flux, Flux.fromArray(baseIndex).flatMap(index -> index.allSubtypesOf(type)));
    }
}
Also used : Arrays(java.util.Arrays) JarIndexer(org.jboss.jandex.JarIndexer) DotName(org.jboss.jandex.DotName) Supplier(com.google.common.base.Supplier) Tuples(reactor.util.function.Tuples) Tuple2(reactor.util.function.Tuple2) HashMap(java.util.HashMap) IJavadocProvider(org.springframework.ide.vscode.commons.java.IJavadocProvider) FuzzyMatcher(org.springframework.ide.vscode.commons.util.FuzzyMatcher) ClassInfo(org.jboss.jandex.ClassInfo) IMethod(org.springframework.ide.vscode.commons.java.IMethod) Indexer(org.jboss.jandex.Indexer) IField(org.springframework.ide.vscode.commons.java.IField) Map(java.util.Map) Suppliers(com.google.common.base.Suppliers) Schedulers(reactor.core.scheduler.Schedulers) IAnnotation(org.springframework.ide.vscode.commons.java.IAnnotation) IndexView(org.jboss.jandex.IndexView) IndexReader(org.jboss.jandex.IndexReader) Iterator(java.util.Iterator) Log(org.springframework.ide.vscode.commons.util.Log) Predicate(java.util.function.Predicate) IJavadoc(org.springframework.ide.vscode.commons.javadoc.IJavadoc) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) Collectors(java.util.stream.Collectors) File(java.io.File) ExecutionException(java.util.concurrent.ExecutionException) Flux(reactor.core.publisher.Flux) List(java.util.List) Stream(java.util.stream.Stream) Optional(java.util.Optional) IType(org.springframework.ide.vscode.commons.java.IType) CacheBuilder(com.google.common.cache.CacheBuilder) Cache(com.google.common.cache.Cache) InputStream(java.io.InputStream) IndexView(org.jboss.jandex.IndexView) DotName(org.jboss.jandex.DotName) IType(org.springframework.ide.vscode.commons.java.IType)

Aggregations

IndexView (org.jboss.jandex.IndexView)11 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Map (java.util.Map)4 InputStream (java.io.InputStream)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 ClassInfo (org.jboss.jandex.ClassInfo)3 Supplier (com.google.common.base.Supplier)2 Suppliers (com.google.common.base.Suppliers)2 Cache (com.google.common.cache.Cache)2 CacheBuilder (com.google.common.cache.CacheBuilder)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 Arrays (java.util.Arrays)2 Collection (java.util.Collection)2 Iterator (java.util.Iterator)2 Optional (java.util.Optional)2 Set (java.util.Set)2