Collection<LookupResult> lookupMostSpecificModels(Resource resource) {
        if (resource == null) {
            throw new IllegalArgumentException("Method argument resource must not be null.");
        }

        final Key key = key(resource);

        if (isUnmapped(key)) {
            return null;
        }

        Collection<LookupResult> sources = lookupFromCache(key);

        if (sources == null) {
            final int currentStateId = this.state.get();
            sources = resolveMostSpecificModelSources(resource);

            if (sources.isEmpty()) {
                markAsUnmapped(key, currentStateId);
            } else {
                cache(key, sources, currentStateId);
            }
        }
        return nullIfEmpty(sources);
    }
Collection < LookupResult > lookupMostSpecificModels ( Resource resource ) { if ( resource == null ) { throw new IllegalArgumentException ( "Method argument resource must not be null." ) ; } final Key key = key ( resource ) ; if ( isUnmapped ( key ) ) { return null ; } Collection < LookupResult > sources = lookupFromCache ( key ) ; if ( sources == null ) { final int currentStateId = this . state . get ( ) ; sources = resolveMostSpecificModelSources ( resource ) ; if ( sources . isEmpty ( ) ) { markAsUnmapped ( key , currentStateId ) ; } else { cache ( key , sources , currentStateId ) ; } } return nullIfEmpty ( sources ) ; }
Finds the most specific models for the given {@link Resource}, i.e. the
first model(s) found when traversing the resource's
{@link MappableTypeHierarchy mappable hierarchy}.

@param resource must not be <code>null</code>.
@return the model sources, or <code>null</code> if no models exist for the resource.