private Collection<LookupResult> resolveModelSources(Resource resource, Class<?> compatibleType, boolean resolveMostSpecific) {
        Collection<LookupResult> sources = new ArrayList<>(64);
        for (final String resourceType : mappableTypeHierarchyOf(resource)) {
            Collection<OsgiModelSource<?>> allSourcesForType = this.typeNameToModelSourcesMap.get(resourceType);
            Collection<OsgiModelSource<?>> sourcesForCompatibleType = filter(allSourcesForType, compatibleType);
            if (sourcesForCompatibleType != null && !sourcesForCompatibleType.isEmpty()) {
                sources.addAll(sourcesForCompatibleType.stream().map(source -> new LookupResult(source, resourceType)).collect(Collectors.toList()));
                if (resolveMostSpecific) {
                    break;
                }
            }
        }
        return unmodifiableCollection(sources);
    }
private Collection < LookupResult > resolveModelSources ( Resource resource , Class < ? > compatibleType , boolean resolveMostSpecific ) { Collection < LookupResult > sources = new ArrayList < > ( 64 ) ; for ( final String resourceType : mappableTypeHierarchyOf ( resource ) ) { Collection < OsgiModelSource < ? > > allSourcesForType = this . typeNameToModelSourcesMap . get ( resourceType ) ; Collection < OsgiModelSource < ? > > sourcesForCompatibleType = filter ( allSourcesForType , compatibleType ) ; if ( sourcesForCompatibleType != null && ! sourcesForCompatibleType . isEmpty ( ) ) { sources . addAll ( sourcesForCompatibleType . stream ( ) . map ( source -> new LookupResult ( source , resourceType ) ) . collect ( Collectors . toList ( ) ) ) ; if ( resolveMostSpecific ) { break ; } } } return unmodifiableCollection ( sources ) ; }
Finds all {@link OsgiModelSource model sources} representing models for the given
{@link Resource}.

@param resource            must not be <code>null</code>.
@param compatibleType      can be <code>null</code>. If provided, only models
compatible to the given type are returned.
@param resolveMostSpecific whether to resolve only the most specific models.
@return never <code>null</code> but rather an empty collection.